I appreciate the nod/reference (ahh shaft, my web page is all weird with the CSS template now…). Here I was getting ready to call in to the SO podcast to get your opinion on just this matter!!! 8^D
I don’t know if it helps or hinders the discussion, but the only thing about the initial post was that I failed to complete the explanation of things. Somebody else had followed up on the issue (http://stackoverflow.com/questions/231903/how-much-to-log-within-an-application-how-much-is-too-much) and I had added the following comment
In the sample I provided, that method logs on a daily basis in WARN mode. Which means that the only thing that gets logged by default is if an exception occurs. If I get a call from one of my clients about having an error in the application, they don’t have to read me some cryptic message on the screen, I jump in the log and can see what’s going on. Most of the time, the answer is right there.
What happens if the answer isn’t readily available? Log4net allows me to update my configuration file (no re-compilation necessary, no need to get access to some special system file on the web server with the sysadmin’s approval) and go into INFO mode. Now you start seeing a second layer of logging. Maybe the code never made it to a certain loop. Maybe the data retrieval had an empty record set. This second level of debugging is helpful, and the log only gets slightly larger. Once this is done, I can change the config again and go back to the light logging.
Naturally if things are REALLY crazy, then I go to the full debug level, and I want to know what each variable is reporting, what DataRows I’m dealing with, and what is going on in the application. At my current place of work, we don’t have the ability to do remote debugging into our web applications, and we can’t always tap into the production database without potentially augmenting data, so having this full debug is the next best thing.
I agree with the majority of folks out there that excessive logging can really bring down an application and cause more problems than it is worth. If wouldn’t recommend this kind of verbose logging in an application either unless the application warranted it for security reasons. However, being able to leverage verbose logging when needed and without having to recompile my code IS a HUGE benefit in my opinion and if you have a framework that can allow for it easily (such as log4net), then I say get nice and verbose and it is easy enough to mentally filter out the log code references if you’re having to go back into the code itself.
I’m not trying to back peddle or anything, I guess my point was that if the logging architecture can leverage things properly so that you can get everything or nothing at the flick of a switch (or update of a config file without a recompile), then it would be beneficial to do so.