logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 50858] New: Classloader leak when using Log4j in a webapp container such as Tomcat, WebLogic
Date Wed, 02 Mar 2011 23:54:25 GMT

           Summary: Classloader leak when using Log4j in a webapp
                    container such as Tomcat, WebLogic
           Product: Log4j
           Version: unspecified
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Appender
        AssignedTo: log4j-dev@logging.apache.org
        ReportedBy: piepera@pragmatics.com

This is possibly redundant with bug #46221, however, different classes and
libraries appear to be involved, so I am submitting this anyways.

I have implemented a trivial "Hello World" Web Application, which invokes 
"LogManager.getLogger(HelloServlet.class)". Demonstrating the classloader leak
is a little cumbersome, I apologize, but here are the steps:
  1. Deploy the attached "simple.war" to the web container of your choice (I
used Tomcat v6.0.29)
  2. Navigate to http://localhost:8080/simple; you should see a "Hello, world!"
message. A warning will also be logged that log4j was not instantiated
  3. Undeploy "simple.war".
  4. Using jps/jmap/jhat, view the heap dump of your web container. View
references to the WebAppClassLoader, excluding weak references. You will see
that the WebAppClassLoader still has static references from about a dozen Log4j
classes, such as org.apache.log4j.Category and org.apache.log4j.Priority.ERROR.

I also implemented a ServletContextListener to call LogManager.shutDown() and
Introspector.flushCaches(), following advice from
http://marc.info/?l=log4j-user&m=109585865720819. This didn't solve the
problem. The only way I could resolve the ClassLoader leak was to remove all
references to LogManager.

Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org

View raw message