Woodchuck,
 
I guess, the alternative solution is to have all your web apps use log4j
as well.
 
So, you have commons-logging.jar and log4j.jar in the
${Tomcat}/common/lib folder
and log4j.properties in ${Tomcat}/common/classes folder.
 
Just add into your each web app's WEB-INF/classes folder
log4j.properties file and
into WEB-INF/lib folder log4j.jar.
 
This way both Tomcat and your web apps will use separate log4j
configurations.
 
Thanks,
Seva
 
________________________________

From: Paul Austin [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, August 31, 2005 1:30 PM
To: Tomcat Users List
Subject: Re: Tomcat 5.5 classloader log4j vs JCL issue
 
Woodchuck,

The following web page describes this situation and a solution to the
problem.
http://www.qos.ch/logging/sc.jsp

I have attached the solution that I created this week based on the
information above. To compile you will need servlet-api.jar and
log4j.jar to compile.

Include the jar you create from these files in your web application and
then in your web.xml include the following sections.

This section can be used if your log4j.xml is not under
/WEB-INF/log4j.xml
  <context-param>
    <param-name>log4jXmlLocation</param-name>
    <param-value>/WEB-INF/log4j.xml</param-value>
  </context-param>

The following calls invokes the listerner when the web app starts up to
create a separate logging context for the web application.

  <listener>
 
<listener-class>com.revolsys.logging.log4j.Log4jServletContextListener</
listener-class>
  </listener>

Also make sure you have a listener that does the following when the
context is destroyed otherwise you'll get a log of PermGen out of memory
errors after a number of redeploys

        Introspector.flushCaches();
        LogFactory.getFactory().release();

Good luck,
Paul

On Wed, 2005-08-31 at 13:03 -0700, Woodchuck wrote: 
 
hihi all,
 
on my TC 5.5.9 installation i deployed several web applications that
uses the default JCL logging.  that is, i placed a simple
logging.properties file into each web app's WEB-INF/classes folder and
i have per web app logging.  everything works beautifully.
 
then i installed a new web app that forced me to place
commons-logging.jar and log4j.jar into the ${Tomcat}/common/lib folder.
 as a result, all my previous per web app logging no longer works.
 
i believe this is because log4j was discovered in the
${Tomcat}/common/lib first, and therefore it has superceeded any other
logging system at the (lower) web app level.  this is due to Tomcat's
classloading process.
 
the reason this new web app required commons-logging.jar and log4j.jar
to be placed specifically into the ${Tomcat}/commons/lib folder is
because it instantiates a log4j logger object in it's start-up servlet
which extends HttpServlet which is found in the servlet-api.jar which
is also in the ${Tomcat}/commons/lib folder.  this is because Tomcat's
classloading hierarchy dictates that classes in the common/lib cannot
see web app classes 'downstream'.
 
does anyone have any suggestions on how i can have per web app logging
again?  i would like to keep my deployment process as web app isolated
as possible (ie. each web app deployed by WAR, drop it in and that's
it, no further steps necessary).
 
thanks in advance,
woodchuck
 
 
               
____________________________________________________
Start your day with Yahoo! - make it your home page 
http://www.yahoo.com/r/hs 
 
 
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 

Reply via email to