Tomcat Logging in WTP

I’ve just been trying to enable debug logging for tomcat (don’t ask). Normally you do this by editing $CATALINA_HOME/conf/ 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/ ]; then
  JAVA_OPTS="$JAVA_OPTS -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager"

But Eclipse runs the Java code directly, without using So the properties never gets set. You have to set them by hand in the “Run Configurations” dialog. Like this:

Setting system properties for tomcat in Eclipse

Of note there is that I’ve imported the 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 $WORKSPACE/.metadata/.plugins/org.eclipse.wst.server.core/tmp0.

Comments 3

  1. Jason wrote:

    Thanks, I’ve been tearing my hair out for a few hours trying to figure out why my stand alone tomcat install didn’t log when I found this. I’d read that FAQ too, but skipped over that entry as it seemed like I’d already done that. Dur. 🙂

    Thanks again.

    Posted 02 Nov 2008 at 20:31
  2. dom wrote:

    It took me long enough to figure out, so it seemed worth writing up. Glad I was right. 🙂

    Posted 02 Nov 2008 at 20:45
  3. Nishant Kyal wrote:

    Do you know how to enable logging for webapps in eclipse-tomcat. I’ve multiple webapps each having it’s own logger properties. The solution above got the tomcat loggers running but not the webapp ones 🙁

    Appreciate your help. Atleast got over the first bump 🙂

    Posted 09 Nov 2011 at 10:49