Martin Grigorov created LOG4J2-1222:
---------------------------------------

             Summary: Initializing Logger during JVM shutdown fails with FATAL 
error
                 Key: LOG4J2-1222
                 URL: https://issues.apache.org/jira/browse/LOG4J2-1222
             Project: Log4j 2
          Issue Type: Bug
          Components: Core
    Affects Versions: 2.5, 2.4
            Reporter: Martin Grigorov


Trying to stop a web application leads to the following problem:

{code}
[INFO] Stopped ServerConnector@7fad214a{HTTP/1.1,[http/1.1]}{0.0.0.0:8080}
[INFO] Stopped ServerConnector@7793ad58{SSL,[ssl, http/1.1]}{0.0.0.0:8443}
2015-12-12 19:09:24,604 Thread-1 FATAL Unable to register shutdown hook because 
JVM is shutting down. java.lang.IllegalStateException: Cannot add new shutdown 
hook as this is not started. Current state: STOPPED
        at 
org.apache.logging.log4j.core.util.DefaultShutdownCallbackRegistry.addShutdownCallback(DefaultShutdownCallbackRegistry.java:113)
        at 
org.apache.logging.log4j.core.impl.Log4jContextFactory.addShutdownCallback(Log4jContextFactory.java:271)
        at 
org.apache.logging.log4j.core.LoggerContext.setUpShutdownHook(LoggerContext.java:240)
        at 
org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:201)
        at 
org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:146)
        at 
org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:41)
        at org.apache.logging.log4j.LogManager.getContext(LogManager.java:177)
        at 
org.apache.logging.log4j.spi.AbstractLoggerAdapter.getContext(AbstractLoggerAdapter.java:103)
        at 
org.apache.logging.slf4j.Log4jLoggerFactory.getContext(Log4jLoggerFactory.java:43)
        at 
org.apache.logging.log4j.spi.AbstractLoggerAdapter.getLogger(AbstractLoggerAdapter.java:42)
        at 
org.apache.logging.slf4j.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:29)
        at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:284)
        at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:304)
        at 
org.apache.wicket.core.util.lang.PropertyResolver.<clinit>(PropertyResolver.java:75)
        at org.apache.wicket.Application.internalDestroy(Application.java:786)
        at 
org.apache.wicket.protocol.http.WebApplication.internalDestroy(WebApplication.java:704)
        at 
org.apache.wicket.protocol.http.WicketFilter.destroy(WicketFilter.java:614)
        at 
org.eclipse.jetty.servlet.FilterHolder.destroyInstance(FilterHolder.java:172)
        at org.eclipse.jetty.servlet.FilterHolder.doStop(FilterHolder.java:150)
        at 
org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:89)
        at 
org.eclipse.jetty.util.component.ContainerLifeCycle.stop(ContainerLifeCycle.java:143)
        at 
org.eclipse.jetty.util.component.ContainerLifeCycle.doStop(ContainerLifeCycle.java:161)
        at 
org.eclipse.jetty.server.handler.AbstractHandler.doStop(AbstractHandler.java:73)
....
{code}

The problem is at:
{code}
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:304)
        at 
org.apache.wicket.core.util.lang.PropertyResolver.<clinit>(PropertyResolver.java:75)
{code}

During shutdown a class (PropertyResolver) is loaded for a first time and its 
'private static final Logger' leads to the above problem.

The problem appears first in 2.4. There is no such issue with 2.3.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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

Reply via email to