logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Raman Gupta (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (LOG4J2-1618) JVM shutdown fails with ClassCastException on SimpleLogger to Logger
Date Wed, 28 Sep 2016 21:14:20 GMT

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

Raman Gupta updated LOG4J2-1618:
--------------------------------
    Description: 
Apparently the fix for https://issues.apache.org/jira/browse/LOG4J2-1222 is causing a new
issue when log4j-jul is enabled:

{noformat}
2016-09-28 16:54:29,300 Thread-1 WARN Unable to register Log4j shutdown hook because JVM is
shutting down. Using SimpleLogger
Exception in thread "Thread-1" java.lang.ExceptionInInitializerError
	at io.grpc.internal.SharedResourceHolder.releaseInternal(SharedResourceHolder.java:152)
	at io.grpc.internal.SharedResourceHolder.release(SharedResourceHolder.java:112)
	at io.grpc.internal.ServerImpl.shutdown(ServerImpl.java:182)
	at io.grpc.internal.ServerImpl.shutdown(ServerImpl.java:79)
	at com.rocketraman.Foo.stop(Foo.kt:39)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassCastException: org.apache.logging.log4j.simple.SimpleLogger cannot
be cast to org.apache.logging.log4j.core.Logger
	at org.apache.logging.log4j.jul.CoreLoggerAdapter.newLogger(CoreLoggerAdapter.java:37)
	at org.apache.logging.log4j.jul.CoreLoggerAdapter.newLogger(CoreLoggerAdapter.java:31)
	at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getLogger(AbstractLoggerAdapter.java:48)
	at org.apache.logging.log4j.jul.LogManager.getLogger(LogManager.java:89)
	at java.util.logging.LogManager.demandLogger(LogManager.java:551)
	at java.util.logging.Logger.demandLogger(Logger.java:455)
	at java.util.logging.Logger.getLogger(Logger.java:502)
	at io.grpc.internal.LogExceptionRunnable.<clinit>(LogExceptionRunnable.java:47)
	... 7 more
{noformat}

If I follow the chain of inheritance of `SimpleLogger`, the top-level interface is `org.apache.logging.log4j.Logger`
from the -api jar, not `org.apache.logging.log4j.core.Logger` from the -core jar.


  was:
Apparently the fix for https://issues.apache.org/jira/browse/LOG4J2-1222 is causing a new
issue:

{noformat}
2016-09-28 16:54:29,300 Thread-1 WARN Unable to register Log4j shutdown hook because JVM is
shutting down. Using SimpleLogger
Exception in thread "Thread-1" java.lang.ExceptionInInitializerError
	at io.grpc.internal.SharedResourceHolder.releaseInternal(SharedResourceHolder.java:152)
	at io.grpc.internal.SharedResourceHolder.release(SharedResourceHolder.java:112)
	at io.grpc.internal.ServerImpl.shutdown(ServerImpl.java:182)
	at io.grpc.internal.ServerImpl.shutdown(ServerImpl.java:79)
	at com.rocketraman.Foo.stop(Foo.kt:39)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassCastException: org.apache.logging.log4j.simple.SimpleLogger cannot
be cast to org.apache.logging.log4j.core.Logger
	at org.apache.logging.log4j.jul.CoreLoggerAdapter.newLogger(CoreLoggerAdapter.java:37)
	at org.apache.logging.log4j.jul.CoreLoggerAdapter.newLogger(CoreLoggerAdapter.java:31)
	at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getLogger(AbstractLoggerAdapter.java:48)
	at org.apache.logging.log4j.jul.LogManager.getLogger(LogManager.java:89)
	at java.util.logging.LogManager.demandLogger(LogManager.java:551)
	at java.util.logging.Logger.demandLogger(Logger.java:455)
	at java.util.logging.Logger.getLogger(Logger.java:502)
	at io.grpc.internal.LogExceptionRunnable.<clinit>(LogExceptionRunnable.java:47)
	... 7 more
{noformat}

If I follow the chain of inheritance of `SimpleLogger`, the top-level interface is `org.apache.logging.log4j.Logger`
from the -api jar, not `org.apache.logging.log4j.core.Logger` from the -core jar.



> JVM shutdown fails with ClassCastException on SimpleLogger to Logger
> --------------------------------------------------------------------
>
>                 Key: LOG4J2-1618
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-1618
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.6.2
>            Reporter: Raman Gupta
>
> Apparently the fix for https://issues.apache.org/jira/browse/LOG4J2-1222 is causing a
new issue when log4j-jul is enabled:
> {noformat}
> 2016-09-28 16:54:29,300 Thread-1 WARN Unable to register Log4j shutdown hook because
JVM is shutting down. Using SimpleLogger
> Exception in thread "Thread-1" java.lang.ExceptionInInitializerError
> 	at io.grpc.internal.SharedResourceHolder.releaseInternal(SharedResourceHolder.java:152)
> 	at io.grpc.internal.SharedResourceHolder.release(SharedResourceHolder.java:112)
> 	at io.grpc.internal.ServerImpl.shutdown(ServerImpl.java:182)
> 	at io.grpc.internal.ServerImpl.shutdown(ServerImpl.java:79)
> 	at com.rocketraman.Foo.stop(Foo.kt:39)
> 	at java.lang.Thread.run(Thread.java:745)
> Caused by: java.lang.ClassCastException: org.apache.logging.log4j.simple.SimpleLogger
cannot be cast to org.apache.logging.log4j.core.Logger
> 	at org.apache.logging.log4j.jul.CoreLoggerAdapter.newLogger(CoreLoggerAdapter.java:37)
> 	at org.apache.logging.log4j.jul.CoreLoggerAdapter.newLogger(CoreLoggerAdapter.java:31)
> 	at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getLogger(AbstractLoggerAdapter.java:48)
> 	at org.apache.logging.log4j.jul.LogManager.getLogger(LogManager.java:89)
> 	at java.util.logging.LogManager.demandLogger(LogManager.java:551)
> 	at java.util.logging.Logger.demandLogger(Logger.java:455)
> 	at java.util.logging.Logger.getLogger(Logger.java:502)
> 	at io.grpc.internal.LogExceptionRunnable.<clinit>(LogExceptionRunnable.java:47)
> 	... 7 more
> {noformat}
> If I follow the chain of inheritance of `SimpleLogger`, the top-level interface is `org.apache.logging.log4j.Logger`
from the -api jar, not `org.apache.logging.log4j.core.Logger` from the -core jar.



--
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


Mime
View raw message