Logging and Tracing in software
If your not a software developer this post is not for you.
I read with some interest Jeff Atwood's post on logging. He makes some interesting points, and it got me thinking once again about this whole area of logging. I think a lot of the debate misses an important point. Who is the log data for? There are essentially two answers:
- For a developer or service engineer to work out what went wrong after a problem occurs
- For a user of a system to check on the state of the program.
The example in Jeff's post I would use info, error and fatal for the second class of user, not the first. Following this the info messages would become debug statements. I would also count the "handled exceptions" as debug data.
Two important things to note from Jeff's post is that logging (or tracing) is not free. If it is not enabled the overhead should be zero (or as close to zero as possible), and the messages for the second class of user should be easy to read, perhaps via a user interface of similar.
In WebSphere Application Server every info, warning and error message is written to a file and results in a JMX notification. At one point the overhead of this was 79ms per message, as a result I aim to only output exceptional messages.
Alasdair
No comments:
Post a Comment