I'd like to use Log4J at the server level, but following the 
http://tomcat.apache.org/tomcat-6.0-doc/logging.html instructions at
apache.org  doesn't seeem to work with 6.0.18.

1)  Rebuilding tomcat-juli.jar using extras.xml doesn't include an adapter
for Log4J.  The build file lists
org/apache/juli/logging/impl/Jdk14Logger.class, but not
org/apache/juli/logging/impl/Log4JLogger.class, and indeed if you turn on
Commons Logging diagnostics, you can see it failing to find Log4JLogger and
then finding Jdk14Logger in the JAR (and then trying to fail back to JDK
logging.)

2)  If I fix the build file to include Log4JLogger, it still fails; the
Commons Logging diagnostics say the class is "missing dependencies", which
occurs when the instantiation throws a NoClassDefFoundError.  Not
surprising; if log4j.jar is placed in catalina.home/lib per instructions,
it's not on the system classpath, which is used by bootstrap.jar.

3)  Because the build of tomcat-juli.jar doesn't include the JULI default
log handlers, the fallback to JDK logging fails in either case, with a
ClassNotFoundException on org.apache.juli.FileHandler.

I can't move log4j.jar to the system classpath, because then it will be
visible to all webapps, and I will have to use a custom Log4J
RepositorySelector (presumably with a context classloader-keyed hash map et
cetera, ugh.)

Another option is to re-root all of Log4J under org.apache.juli and
duplicate it in tomcat-juli.jar.  Double ugh, no thanks.

I would be OK with using JDK logging just during server bootstrap, if I
could get Log4J for the rest of the server (via the Common classpath.)

Thanks,
Jonathan

-- 
View this message in context: 
http://www.nabble.com/Seeking-authoritative-answer-re-using-Log4J-with-v6-tp24225048p24225048.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to