Logging Tomcat 6 startup via log4j

For a recent task I had the need to log the tomcat startup process via log4j (so I could view it in eclipse using the log4eclipse plugin).
The simple copying log4j.properties and log4j.jar into TOMCAT/lib didn't work as it had for previous versions.
After some quick digging around I finally read the right section of the documentation. The steps are pretty easy to follow.

The jar of juli (their logger) that comes with the standard build doesn't allow for commons-logging.
To get it to work you need to download the source and compile the extras commons-logging.
Which is a simple:
ant download
ant build-only
ant -f extras.xml commons-logging
Next:
  1. Replace $CATALINA_HOME/bin/tomcat-juli.jar with output/extras/tomcat-juli.jar.
  2. Place output/extras/tomcat-juli-adapters.jar in $CATALINA_HOME/lib.

For apache-tomcat-6.0.14-src you'll need to change build.properties.default line 45:
jdt.loc=http://archive.eclipse.org/eclipse/downloads/drops/R-3.2.2-200702121330/eclipse-JDT-3.2.2.zip

Additionally as of apache-tomcat-6.0.18-src, there are errors compiling the target build-tomcat-dbcp using JDK 1.6; so use JDK 1.5 to do the 'ant download' step (or all).

Comments