I’ve just been trying to enable debug logging for tomcat (don’t ask). Normally you do this by editing
$CATALINA_HOME/conf/logging.properties and restarting.
Except I tried that in Eclipse (using WTP) and it didn’t work.
I tried copying it to the
$CATALINA_BASE/conf directory instead1.
Still no joy.
I’ve just found the answer, after looking in the tomcat source. It turns out that tomcat’s alternative logging implementation (JULI) is enabled via a system property. This happens inside
# Set juli LogManager if it is present if [ -r "$CATALINA_BASE"/conf/logging.properties ]; then JAVA_OPTS="$JAVA_OPTS -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager" LOGGING_CONFIG="-Djava.util.logging.config.file=$CATALINA_BASE/conf/logging.properties" fi
But Eclipse runs the Java code directly, without using
catalina.sh. So the properties never gets set. You have to set them by hand in the “Run Configurations” dialog. Like this:
Of note there is that I’ve imported the
logging.properties file into the
Servers project of my workspace. It seemed liked a useful place to put it.
Of course, after realising that, I soon find the same information in the WTP FAQ: How do I enable the JULI logging in a Tomcat 5.5 Server instance?.
Anyway, now I might be able to debug that ClassLoader issue…
1 Inside Eclipse with WTP, that will be something like