How do I enable DEBUG logging for category org.apache.catalina in the Tomcat distribution?

Adding the following category in $NUXEO_HOME/lib/log4j.xml does not seem to enable DEBUG logging for “org.apache.catalina” within the Tomcat Nuxeo Distribution. Does this category require special configuration?

1 votes

1 answers

16067 views

ANSWER

Nope, normally this enough… You just have to restart your tomcat, normally. Check that there is no other child category of org.apache.catalina into your log4j.xml.
03/29/2012

ron
I am using the standard nuxeo 5.5 tomcat-based distribution and I have no other child categories of org.apache.catalina. DEBUG priority works fine for other categories. However, DEBUG priority seems to be ignored for org.apache.catalina.
03/30/2012

ron
Are you sure enabling org.apache.catalina debug logging via a standard $NUXEO_HOME/lib/log4j.xml modification works with a Nuxeo 5.5 Tomcat Distribution and causes these logging statements to be added to the normal nuxeo server.log? I am suspicious there might be conflicts between the logging.properties in $NUXEO_HOME/conf and the log4j.xml in $NUXEO_HOME/lib.
03/30/2012



Hello,

$NUXEO_HOME/conf/logging.properties has no effect; you can safely remove it.

The point is Tomcat uses java.util.logging whereas Nuxeo uses Log4J.

Nuxeo provides a bridge for redirecting java.util.logging to Apache Commons Logging (compliant with Log4J) with a default threshold set at INFO level. You can customize it by adding into nuxeo.conf:

JAVA_OPTS=$JAVA_OPTS -Dorg.nuxeo.runtime.redirectJUL.threshold=DEBUG

Edit: the right corresponding JUL value for Log4J DEBUG level is

JAVA_OPTS=$JAVA_OPTS -Dorg.nuxeo.runtime.redirectJUL.threshold=CONFIG

But that redirection is only available after Nuxeo Framework initialization whereas most of the startup logs from org.apache.catalina happen before (when the redirection is not yet active).

So, if you want to see Catalina messages, you must also:

  • go on Tomcat 6 download page, then “Quick Navigation”, “Browse”, “bin”, “extras”
  • download tomcat-juli-adapters.jar into $NUXEO_HOME/lib/
  • download tomcat-juli.jar into $NUXEO_HOME/bin/ (replace the existing one)

At this point, the Log4J configuration will also apply on logs sent to java.util.logging; the category you added will work.

You may be interested by NXP-7014.

1 votes



ron
Much thanks for the post! This is the exact information I was looking for.
04/06/2012

Hello Julien, i tryed to add leading instruction in my nuxeo.conf, but server does not start, (bad level "DEBUG" error is logged). Also, if i change DEBUG with INFO server is starting up as expected.
02/20/2013

The sample value was not good: DEBUG is a Log4J level, not valid for JUL. JUL levels are SEVERE, WARNING, INFO, CONFIG, FINE, FINER and FINEST.

Note the Nuxeo bridge will ignore FINER and FINEST which are too much verbose, FINE is mapped with TRACE and CONFIG with DEBUG.

02/20/2013

Note: tomcat-juli* JARs are already included in the server since Nuxeo 5.7.2
08/06/2013