You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by "Ralph Goers (JIRA)" <ji...@apache.org> on 2016/01/24 07:01:39 UTC

[jira] [Resolved] (LOG4J2-1222) Initializing Logger during JVM shutdown fails with FATAL error

     [ https://issues.apache.org/jira/browse/LOG4J2-1222?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ralph Goers resolved LOG4J2-1222.
---------------------------------
       Resolution: Fixed
    Fix Version/s: 2.5.1

During shutdown trying to create a LoggerContext will now fail with an error message. LogManager will then use the SimpleLogger for any further logging.

Please verify that this works the way you wanted and close the issue if it does.

> 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.4, 2.5
>            Reporter: Martin Grigorov
>            Assignee: Ralph Goers
>             Fix For: 2.5.1
>
>         Attachments: log4j2-1222.tgz
>
>
> 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-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org