tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <>
Subject Re: Weblogic library and Tomcat
Date Thu, 12 Feb 2009 22:52:34 GMT
Hash: SHA1

Mark and Mikolaj,

On 2/12/2009 6:19 AM, Mark Thomas wrote:
> Mikolaj Rydzewski wrote:
>> Mark Thomas wrote:
>>> As well as JDBC drivers, logging frameworks are frequent culprits for
>>> causing this.
>> What about commons-logging and log4j?
>  [snip]
> If commons-logging and log4j and deployed as part of your webapp you should be OK.

I have written a contextListener that attempts to clean-up after log4j
during webapp shutdown. It also reads my log4j configuration on startup,
which you can probably ignore. Maybe this would help you:

package org.childhealthcare.diagnosis.servlet;

import javax.servlet.ServletContext;
import javax.servlet.ServletContextListener;
import javax.servlet.ServletContextEvent;

import org.apache.log4j.PropertyConfigurator;
import org.apache.log4j.Logger;
import org.apache.log4j.LogManager;

 * A listener to initialize log4j.
 * @author Chris Schultz
 * @version $Revision: 1.1 $ $Date: 2008-05-27 21:11:53 $
public class Log4jListener
    implements ServletContextListener
    private Logger logger;

    public void contextInitialized(ServletContextEvent e)
        // Trigger loading of the file from the classpath.
        new PropertyConfigurator();

        logger = Logger.getLogger(this.getClass());"Log4j initialized");

    public void contextDestroyed(ServletContextEvent e)
  "Log4j was loaded by application classloader;
shutting down.");

  "Log4j was loaded by some other ClassLoader; not
shutting down.");

Whenever I stop Tomcat, though, I get this message (after the "log4j was
loaded by webapp classloader" message) in catalina.out:

Feb 12, 2009 5:49:19 PM org.apache.catalina.core.StandardService stop
INFO: Stopping service Catalina
log4j:ERROR LogMananger.repositorySelector was null likely due to error
in class reloading, using NOPLoggerRepository.

I'm a little unclear as to whether that log4j error message is coming
from Tomcat trying to shut down log4j or what. log4j.jar is only
available in my webapp's WEB-INF/lib directory.


- -chris
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla -


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

View raw message