[ 
https://issues.apache.org/jira/browse/LOG4J2-832?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14137858#comment-14137858
 ] 

Seth Leger commented on LOG4J2-832:
-----------------------------------

Here's the stack trace from that test:

{noformat}
java.lang.NoClassDefFoundError: Could not initialize class 
Log4j2UninitializableClassTest$AlwaysThrowsError
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:270)
        at 
org.apache.logging.log4j.core.util.Loader.initializeClass(Loader.java:256)
        at 
org.apache.logging.log4j.core.impl.ThrowableProxy.loadClass(ThrowableProxy.java:499)
        at 
org.apache.logging.log4j.core.impl.ThrowableProxy.toExtendedStackTrace(ThrowableProxy.java:620)
        at 
org.apache.logging.log4j.core.impl.ThrowableProxy.<init>(ThrowableProxy.java:146)
        at 
org.apache.logging.log4j.core.impl.Log4jLogEvent.getThrownProxy(Log4jLogEvent.java:323)
        at 
org.apache.logging.log4j.core.pattern.ExtendedThrowablePatternConverter.format(ExtendedThrowablePatternConverter.java:64)
        at 
org.apache.logging.log4j.core.pattern.PatternFormatter.format(PatternFormatter.java:36)
        at 
org.apache.logging.log4j.core.layout.PatternLayout.toSerializable(PatternLayout.java:191)
        at 
org.apache.logging.log4j.core.layout.PatternLayout.toSerializable(PatternLayout.java:52)
        at 
org.apache.logging.log4j.core.layout.AbstractStringLayout.toByteArray(AbstractStringLayout.java:67)
        at 
org.apache.logging.log4j.core.appender.AbstractOutputStreamAppender.append(AbstractOutputStreamAppender.java:106)
        at 
org.apache.logging.log4j.core.config.AppenderControl.callAppender(AppenderControl.java:99)
        at 
org.apache.logging.log4j.core.config.LoggerConfig.callAppenders(LoggerConfig.java:430)
        at 
org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:409)
        at 
org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:367)
        at org.apache.logging.log4j.core.Logger.logMessage(Logger.java:112)
        at 
org.apache.logging.log4j.spi.AbstractLogger.logMessage(AbstractLogger.java:727)
        at 
org.apache.logging.log4j.spi.AbstractLogger.logIfEnabled(AbstractLogger.java:716)
        at 
org.apache.logging.log4j.spi.AbstractLogger.error(AbstractLogger.java:354)
        at 
Log4j2UninitializableClassTest.testLoggingStackTraceWithClassThatCannotInitialize(Log4j2UninitializableClassTest.java:43)
{noformat}

> ThrowableProxy fails if a class in logged stack trace throws java.lang.Error 
> from initializer
> ---------------------------------------------------------------------------------------------
>
>                 Key: LOG4J2-832
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-832
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.0, 2.0.2, 2.1
>         Environment: Java 1.7u67 Linux/OSX/Win7, Java 1.7u60 Linux, Java 
> 1.7u25 Linux
>            Reporter: Seth Leger
>            Priority: Blocker
>         Attachments: LOG4J2-832.patch, Log4j2MethodUtilTrampolineTest.java, 
> Log4j2MethodUtilTrampolineTest.java, Log4j2UninitializableClassTest.java, 
> ggregory-log4j2.patch, pom.xml
>
>
> When the Logger attempts to log a message with an exception stack trace, it 
> uses the ThrowableProxy class to introspect classes in the stack trace frames.
> If the class sun.reflect.misc.Trampoline is in the stack trace, the 
> introspection performed by ThrowableProxy will fail causing a java.lang.Error 
> to be thrown by the Logger call.
> The sun.reflect.misc.Trampoline class is used by the 
> sun.reflect.misc.MethodUtil class to perform reflection-based method 
> invocations. MethodUtil is widely used by libraries to perform method 
> invocations. I've encountered this problem when invoking methods over JMX and 
> inside Jetty.
> I am classifying this as a blocker because it means that any logging 
> statement that is logging a Throwable message containing a MethodUtil-based 
> reflection stack trace can cause a java.lang.Error to be thrown by Log4j2. 
> I will attach a unit test for this failure.



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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to