[
https://issues.apache.org/jira/browse/LOG4J2-223?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13661604#comment-13661604
]
Ralph Goers commented on LOG4J2-223:
------------------------------------
The shutdown hook is necessary in applications that aren't web apps (i.e. -
there is no equivalent of a Servlet context listener). Please remember that
Log4j has to work in standalone apps, web apps where the jars in the Tomcat
ClassLoader, web apps where each has the log4j classes, ejbs (yuck), etc.
As I said, with the BasicContextListener the behavior you should get should
match Log4j 1.x - it won't shutdown the LoggerContext and the appenders, etc.
won't be gracefully cleaned up. Adding the context listener provides that.
A filter and context listener do very different things. You can't set a
ThreadLocal in a context listener. Likewise, unless you are using the
JNDIContextSelector you don't really want to set the ThreadLocal.
ContextSelectors are chosen via a system property. They can also be specified
in the file "log4j2.component.properties" which is read when LogManager is
first called.
> IllegalStateException thrown during Tomcat shutdown
> ---------------------------------------------------
>
> Key: LOG4J2-223
> URL: https://issues.apache.org/jira/browse/LOG4J2-223
> Project: Log4j 2
> Issue Type: Bug
> Components: Core
> Affects Versions: 2.0-beta5
> Reporter: Ralph Goers
> Priority: Critical
> Fix For: 2.0-beta7
>
> Attachments: log4j-223.war
>
>
> {noformat}Apr 25, 2013 3:03:33 PM org.apache.catalina.core.StandardServer
> await
> INFO: A valid shutdown command was received via the shutdown port. Stopping
> the Server instance.
> Apr 25, 2013 3:03:33 PM org.apache.coyote.AbstractProtocol pause
> INFO: Pausing ProtocolHandler ["http-nio-8080"]
> Apr 25, 2013 3:03:33 PM org.apache.coyote.AbstractProtocol pause
> INFO: Pausing ProtocolHandler ["ajp-nio-8009"]
> Apr 25, 2013 3:03:33 PM org.apache.catalina.core.StandardService stopInternal
> INFO: Stopping service Catalina
> Apr 25, 2013 3:03:33 PM org.apache.coyote.AbstractProtocol stop
> INFO: Stopping ProtocolHandler ["http-nio-8080"]
> Apr 25, 2013 3:03:33 PM org.apache.coyote.AbstractProtocol stop
> INFO: Stopping ProtocolHandler ["ajp-nio-8009"]
> Apr 25, 2013 3:03:33 PM org.apache.coyote.AbstractProtocol destroy
> INFO: Destroying ProtocolHandler ["http-nio-8080"]
> Apr 25, 2013 3:03:33 PM org.apache.coyote.AbstractProtocol destroy
> INFO: Destroying ProtocolHandler ["ajp-nio-8009"]
> Apr 25, 2013 3:03:33 PM org.apache.catalina.loader.WebappClassLoader loadClass
> INFO: Illegal access: this web application instance has been stopped already.
> Could not load org.apache.logging.log4j.core.config.NullConfiguration. The
> eventual following stack trace is caused by an error thrown for debugging
> purposes as well as to attempt to terminate the thread which caused the
> illegal access, and has no functional impact.
> java.lang.IllegalStateException
> at
> org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1351)
> at
> org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1310)
> at
> org.apache.logging.log4j.core.LoggerContext.stop(LoggerContext.java:171)
> at
> org.apache.logging.log4j.core.LoggerContext$ShutdownThread.run(LoggerContext.java:389)
> Exception in thread "Thread-18" java.lang.NoClassDefFoundError:
> org/apache/logging/log4j/core/config/NullConfiguration
> at
> org.apache.logging.log4j.core.LoggerContext.stop(LoggerContext.java:171)
> at
> org.apache.logging.log4j.core.LoggerContext$ShutdownThread.run(LoggerContext.java:389)
> Caused by: java.lang.ClassNotFoundException:
> org.apache.logging.log4j.core.config.NullConfiguration
> at
> org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1465)
> at
> org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1310)
> ... 2 more{noformat}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]