Use of NSLog() for debugging
Use of NSLog() for debugging
- Subject: Use of NSLog() for debugging
- From: Art Isbell <email@hidden>
- Date: Fri, 20 Jul 2001 14:08:33 -1000
Many postings to this mailing list discuss using NSLog() for
debugging. I'd like to encourage you to learn to use the debugger, not
NSLog() because
- the debugger is the correct tool for debugging;
- it allows one to examine all sorts of things that might not have been
anticipated when inserting NSLog() statements throughout one's code;
- it's much quicker because one doesn't have to add NSLog() statements,
rebuild, and then remove (and possibly forget to remove) NSLog()
statements afterward;
- adding NSLog() statements can affect execution, memory layout, etc.
such that a bug might not occur after NSLog() statements have been added;
- <append other valid reasons here>
Learning enough of gdb to set breakpoints, examine variable values,
and to control execution is sufficient for most debugging sessions (and
there's PB GUI support for all of this -
file:///Developer/Documentation/DeveloperTools/ProjectBuilder/ProjectBuilder.
help/Contents/Resources/English.lproj/Debugging/index.html). More
sophisticated gdb commands can be entered into gdb's console in PB
(file:///Developer/Documentation/DeveloperTools/gdb/gdb/gdb_toc.html).
Art Isbell
Apple iServices Technical Support
http://www.apple.com/iservices/webobjectssupport/
+1-808-591-0836