tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Boris Unckel" <boris.unckel....@gmx.net>
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 log4j.properties file. But no more 
> trace.
> So As I have no change the lo4j.properties, 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
below.

> - 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
$CATALINA_HOME/common/lib.
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 log4j.properties  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:
http://tomcat.apache.org/tomcat-5.5-doc/logging.html
http://tomcat.apache.org/faq/logging.html

There is an other document describing the classloading:
http://tomcat.apache.org/tomcat-5.5-doc/class-loader-howto.html

Regards
Boris

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


Mime
View raw message