4/13/2005

Best Practices for Java Logging

Today I've been looking into best practices for Java logging. There's alot of information out there, but I was looking for something very tangible - what to log at what level (Apache Commons Logging with Log4j) and when. I found what I was looking for in the Best Practices section of the Apache Commons Logging User Guide.

I'm starting a new project, and I'm going to adopt the recommendations in this guide. I've been logging some things, specifically exceptions, at inappropriate levels. I've been logging too many exceptions at the "debug" level. This causes the administrator to run the application with the "debug" level of logging turned on so that there is traceable information when something goes wrong. In addition, I've been logging too many exceptions at "error".

Hopefully, by following the Commons Logging practices, I'll get a log file with more valuable information.

No comments: