Logging, It's a Good Thing

If Martha Stewart did computer programming, she'd say "Logging, it's a good thing.". Unfortunately, many programmers including me do not make a habit of it.

There are different reasons to do logging:

  • Help figure out what is going on during programming or debugging.
  • Track normal operations of the app.
  • Report trouble or errors.
Yohan Liyanage wrote a nice blog post about how to log. In particular he includes a table with clear descriptions of each of the six levels of logging as specified by the Apache Commons Logging project:
  • INFO
  • WARN
Basically, the first two are for programming & debugging. The middle one, INFO, is for tracking normal operations. The last three are for recording problems.

I ported that "Log" interface to REALbasic, and offer it to everybody. By using an interface, you can switch logging implementations, at design time or run time, without changing the countless logging calls littered throughout your app's code. Also, if everyone in your team, or even the entire REALbasic community, used the very same interface it would be easier to share code containing logging calls.

Robert Elliot wrote a another interesting logging blog post

Aaron Ballman in his "Ramblings" book explains how useful logging is for debugging a GUI app. When running your app from the REAL Studio app, using the debugger can affect the state of your app's GUI. This is one instance of the Observer Effect. This happens to be why he invented the Remote Debugger Stub feature of REAL Studio 2010. The common misconception is that the purpose of Remote Debugger Stub is to test across platforms. But actually it came from his own frustration with this observer effect. By using the Stub, even on the some platform, you can debug without affecting the state of your app.

No comments:

Post a Comment