Debuggers vs debug libraries


I tend to work very much to myself on projects.  I get help from the open source community via discussion forums or mailing lists, but in-house (at work or at home) I'm pretty much on my own to figure things out.  This has led to some development practices which work well for me, but are not necessarily the norm.  One of these is the use of debug libraries in all my code.

While most languages and development environments offer debuggers that let you step through code to find a problem, I find that I seldom use these.  For C code I sometimes use gdb to find where a program crashes, while for java I've never used a debugger.  Instead, one of the first things I do in a project is create a debug library.  I then use this library to save trace information to a file or to the console.  In this way I can always tell what is happening in places where I think something else should be happening without having to examine structures or classes.

But I know the rest of the world is not so old-school as myself and I wonder if I should continue to avoid the potential benefits of a debuggers.  Then I happened across the following quote, which was posted to the Log4J (a logging library for Java programs) web site:

As Brian W. Kernighan and Rob Pike put it in their truly excellent book "The Practice of Programming"

As personal choice, we tend not to use debuggers beyond getting a
stack trace or the value of a variable or two. One reason is that it
is easy to get lost in details of complicated data structures and
control flow; we find stepping through a program less productive
than thinking harder and adding output statements and self-checking
code at critical places. Clicking over statements takes longer than
scanning the output of judiciously-placed displays. It takes less
time to decide where to put print statements than to single-step to
the critical section of code, even assuming we know where that
is. More important, debugging statements stay with the program;
debugging sessions are transient.

Well, if Kernighan and Pike can think like me, I must not be too wrong. So I think I'll stick with debug libraries.