tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Boris Unckel" <>
Subject Re: log4j - Class.forname - black magie
Date Thu, 22 Dec 2005 08:53:23 GMT
Good Morning,

Philippe LEGAY wrote:
> Hello
> I succeed by black magie to have log via log4j  under tomcat 5.5.9. So 
> when a call my servlet, I have some trace into a file (/tmp/phl.log).
> I said black magie, because I had a lot of problems to put the log4.jar 
> in the right place.
> Now, I have just installed the tomcat 5.5.12,  reinstalled by web 
> application and of course the same file. But no more 
> trace.
> So As I have no change the, I think it is a tomcat 
> problem.
Properly not.
> Questions :
> - It seems that Class.forName does not work in tomcat. Why ? bad 
> definition ot the PATH ?
> - How to set the PATH for Class.forName  ?
> - Where is the log4j.jar ? Or Why does I have no exception ? Is there 
> some cache into the TOMCAT server ?
> - Is it possible to load by hand log4j (with Class.forName or other 
> mechanism) and then get (How ? ) the path used to get this library ?
You just have to setup the log configuration and classpathes correct, see

> - And the main question : How must I configure the tomcat server to have 
> log4j trace into my servlet code  ? Which version of log4j  (5.2.11, or 
> more ) ? Whee must I put the log4j.jar : tomcat.5.5.12/share/lib ?
Download Log4J (v1.2 or later) and place the log4j jar in
Download Commons Logging and place the commons-logging.jar (not
commons-logging-api.jar) in $CATALINA_HOME/common/lib with the log4j jar.
To configure the server globally (not per webapp)
Save  into $CATALINA_HOME/common/classes
Remove any log4j.jar or commons-logging.jar from you webapp to test it.

There are two excellent documentations about the configuration:

There is an other document describing the classloading:


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message