Use log4j As Tomcat 7 Logger

Log4j is a common logging framework used within applications. The logging library can also replace the default logging in the following steps:

  1. Stop Tomcat server (if running)
  2. Download log4j library from their website
  3. Extract and copy the jar file to the Tomcat lib directory. For example log4j-1.2.17.jar to {TOMCAT_HOME}\lib
  4. Go to http://apache.mirror.anlx.net/tomcat/tomcat-7/v7.0.34/bin/extras/
  5. Download tomcat-juli-adapters.jar and tomcat-juli.jar
  6. Put tomcat-juli-adapters.jar into {TOMCAT_HOME}\lib
  7. Backup tomcar-juli.jar in {TOMCAT_HOME}\bin
  8. Copy and overwrite tomcat-juli.jar in {TOMCAT_HOME}\bin
  9. Rename {TOMCAT_HOME}\conf\logging.properties so that it does not load the original Tomcat logging properties file e.g logging.properties.jul
  10. Copy the logging.properties file to {TOMCAT_HOME}\lib

Logging in Tomcat

About Danny

I.T software professional always studying and applying the knowledge gained and one way of doing this is to blog. Danny also has participates in a part time project called Energy@Home [http://code.google.com/p/energyathome/] for monitoring energy usage on a premise. Dedicated to I.T since studying pure Information Technology since the age of 16, Danny Tsang working in the field that he has aimed for since leaving school. View all posts by Danny → This entry was posted in Java and tagged , , , . Bookmark the permalink.

Leave a Reply