tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Delbecq <de...@oma.be>
Subject Re: logging does not work in my webapp
Date Tue, 05 Sep 2006 09:50:34 GMT
First, problem solved. It appear a 3rd party library include in my
webapp was doing a manual configuration of log4j, resetting the root
logger and sending logs to some file in the middle of nowhere.


Thanks for information. Am just curious, you tell me to put my
commons-logging and log4j in my webapp (that's what i was doing before
reading docs). However, if i read well the docs (tomcat 5.5) on
classloader, the commons-logging in tomcat/bin will take precedence
because it's a system class and as such can not be overwritten by the
webapp ////$CATALINA_HOME/bin/commons-logging-api.jar is in system
classloader. //

Therefore, from the perspective of a web application, class or resource
loading looks in the following repositories, in this order:

    * Bootstrap classes of your JVM
    * System class loader classses (described above)
    * //WEB-INF/classes/ of your web application
    * //WEB-INF/lib/*.jar/ of your web application
    * /$CATALINA_HOME/common/classes/
    * /$CATALINA_HOME/common/endorsed/*.jar/
    * /$CATALINA_HOME/common/i18n/*.jar/
    * /$CATALINA_HOME/common/lib/*.jar/
    * /$CATALINA_BASE/shared/classes/
    * /$CATALINA_BASE/shared/lib/*.jar/

May the doc be wrong about it? could my commons-logging in webapp take
precedence of the one in tomcat?
//

Boris Unckel a écrit :
> Hello David,
>
> my answers are inline:
> -------- Original-Nachricht --------
> Datum: Tue, 05 Sep 2006 10:46:07 +0200
> Von: David Delbecq <delbd@oma.be>
> An: users@tomcat.apache.org
> Betreff: logging does not work in my webapp
>
>   
>> Hello,
>> using tomcat, the logging does not work in my webapp. I am out of idea,
>> so if someone can suggest me something more to test to get my logs.
>> Here is the situation.
>> I followed instructions on ow to setup tomcat for log4j (that is
>> basically adds the commons-logging and log4j jars in common/lib)
>>     
> I think you are referring to
> http://tomcat.apache.org/tomcat-5.5-doc/logging.html
> which assumes you are using Tomcat 5.5.
> >From the text:
> "Your web applications should certainly use their own log4j configuration. This is valid
with the above configuration. You would place a similar log4j.properties file in your web
application's WEB-INF/classes folder, and log4j1.2.8.jar into WEB-INF/lib. Then specify your
package level logging. This is a basic setup of log4j which does *not* require Commons-Logging,
and you should consult the log4j documentation for more options. This page is intended only
as a bootstrapping guide."
>
> In other words:
> Avoid to put commons-logging and log4j in commons/lib
> and put everything in WEB-INF/lib.
>
> Replace the default commons-logging-api.jar in TOMCAT_HOME/bin with the current version
1.1 and have a look at the diagnostic function
> http://jakarta.apache.org/commons/logging/commons-logging-1.1/troubleshooting.html#Using_JCL_Diagnostics
> Both jars (commons-logging-api.jar and commons-logging.jar should have the same version).
>
>   
>> I setup a log4j.xml file in my WEB-INF/classes/log4j.xml. I know it's
>> read by log4j and used by commons-logging, because when i change the
>> root debug level, it alters the verbosity of struts, bean utils, and so
>> on. Setting up a org.apache category to reduce verbosity to info only
>> does work too.
>>
>> In my custom class i do this:
>>
>>     private static Log log =
>> LogFactory.getLog(SharkEngineBean.class.getName()); 
>> /*be.dissco.shark.jsf.bean.SharkEngineBean*/
>>     
> The use of a static Log is bad practise. Have a look at:
> http://wiki.apache.org/jakarta-commons/Logging/StaticLog
>
> Regards
> Boris
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>   


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


Mime
View raw message