Tomcat 5.x, Commons Logging and Log4J

First of all, I never use Jakarta Commons Logging (JCL) directly in my applications (Log4J is my tool of choice for logging tasks), but as you probably know many frameworks and libraries do all of their logging through JCL. In most cases you will want to catch some of these log messages, so that you can better monitor your application. For example, you will probably want to log all SQL queries that Hibernate issues, at least in the early development phase, so that you can have a better perspective of what is going on.

I usually don’t have a problem with JCL since it finds a Log4J implementation in the classpath, get my configuration and all works fine. Except when it doesn’t.

In this particular case, I had a Spring-Hibernate based web application that I needed to deploy on the Tomcat 5 server. After deploying an application, commons logging couldn’t find a log4j implementation and all logs were redirected to the standard Tomcat log file.

Continue reading on onJava.com

Leave a comment

Your email address will not be published. Required fields are marked *