Discussion:
[jira] [Created] (LOG4J2-832) ThrowableProxy fails if sun.reflect.misc.Trampoline is in logged stack trace
Seth Leger (JIRA)
2014-09-16 18:19:35 UTC
Permalink
Seth Leger created LOG4J2-832:
---------------------------------

Summary: ThrowableProxy fails if sun.reflect.misc.Trampoline is in logged stack trace
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, 2.0
Environment: Java 1.7u60, Java 1.7u25
Reporter: Seth Leger
Priority: Blocker


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)
Seth Leger (JIRA)
2014-09-16 18:21:34 UTC
Permalink
[ https://issues.apache.org/jira/browse/LOG4J2-832?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14135884#comment-14135884 ]

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

This is the cause of the following issue:

https://groups.google.com/forum/#!topic/lmax-disruptor/yLUPn4kkzkk/overview
Post by Seth Leger (JIRA)
ThrowableProxy fails if sun.reflect.misc.Trampoline is in logged stack trace
----------------------------------------------------------------------------
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
Environment: Java 1.7u60, Java 1.7u25
Reporter: Seth Leger
Priority: Blocker
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)
Seth Leger (JIRA)
2014-09-16 18:27:34 UTC
Permalink
[ https://issues.apache.org/jira/browse/LOG4J2-832?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Seth Leger updated LOG4J2-832:
------------------------------
Attachment: Log4j2MethodUtilTrampolineTest.java
pom.xml

Here is a simple unit test that reproduces the problem by invoking a method via reflection using sun.reflect.misc.MethodUtil.
Post by Seth Leger (JIRA)
ThrowableProxy fails if sun.reflect.misc.Trampoline is in logged stack trace
----------------------------------------------------------------------------
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
Environment: Java 1.7u60, Java 1.7u25
Reporter: Seth Leger
Priority: Blocker
Attachments: Log4j2MethodUtilTrampolineTest.java, 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)
Seth Leger (JIRA)
2014-09-16 18:34:34 UTC
Permalink
[ https://issues.apache.org/jira/browse/LOG4J2-832?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14135911#comment-14135911 ]

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

Here's the stack trace from the failure of the unit test:

{noformat}
java.lang.Error: Trampoline must not be defined by the bootstrap classloader
at sun.reflect.misc.Trampoline.<clinit>(MethodUtil.java:55)
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:285)
at org.apache.logging.log4j.core.impl.ThrowableProxy.loadClass(ThrowableProxy.java:500)
at org.apache.logging.log4j.core.impl.ThrowableProxy.toExtendedStackTrace(ThrowableProxy.java:621)
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:189)
at org.apache.logging.log4j.core.layout.PatternLayout.toSerializable(PatternLayout.java:53)
at org.apache.logging.log4j.core.layout.AbstractStringLayout.toByteArray(AbstractStringLayout.java:52)
at org.apache.logging.log4j.core.appender.AbstractOutputStreamAppender.append(AbstractOutputStreamAppender.java:104)
at org.apache.logging.log4j.core.config.AppenderControl.callAppender(AppenderControl.java:97)
at org.apache.logging.log4j.core.config.LoggerConfig.callAppenders(LoggerConfig.java:428)
at org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:407)
at org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:365)
at org.apache.logging.log4j.core.Logger.logMessage(Logger.java:112)
at org.apache.logging.log4j.spi.AbstractLogger.logMessage(AbstractLogger.java:1336)
at org.apache.logging.log4j.spi.AbstractLogger.logIfEnabled(AbstractLogger.java:1325)
at org.apache.logging.log4j.spi.AbstractLogger.error(AbstractLogger.java:551)
at Log4j2MethodUtilTrampolineTest.testTrampolineException(Log4j2MethodUtilTrampolineTest.java:34)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
{noformat}
Post by Seth Leger (JIRA)
ThrowableProxy fails if sun.reflect.misc.Trampoline is in logged stack trace
----------------------------------------------------------------------------
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
Environment: Java 1.7u60, Java 1.7u25
Reporter: Seth Leger
Priority: Blocker
Attachments: Log4j2MethodUtilTrampolineTest.java, 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)
Seth Leger (JIRA)
2014-09-16 18:38:34 UTC
Permalink
[ https://issues.apache.org/jira/browse/LOG4J2-832?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14135924#comment-14135924 ]

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

It looks like Pax Logging had an identical error that was recently fixed:

https://ops4j1.jira.com/browse/PAXLOGGING-169
Post by Seth Leger (JIRA)
ThrowableProxy fails if sun.reflect.misc.Trampoline is in logged stack trace
----------------------------------------------------------------------------
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
Environment: Java 1.7u60, Java 1.7u25
Reporter: Seth Leger
Priority: Blocker
Attachments: Log4j2MethodUtilTrampolineTest.java, 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)
Seth Leger (JIRA)
2014-09-16 18:41:33 UTC
Permalink
[ https://issues.apache.org/jira/browse/LOG4J2-832?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14135924#comment-14135924 ]

Seth Leger edited comment on LOG4J2-832 at 9/16/14 6:40 PM:
------------------------------------------------------------

It looks like Pax Logging had an identical error that was recently fixed by adding a 'catch Throwable' around the introspection:

https://ops4j1.jira.com/browse/PAXLOGGING-169
https://github.com/ops4j/org.ops4j.pax.logging/commit/cc91695d03e4d28046dc96c4186ee154306e41e0


was (Author: soleger):
It looks like Pax Logging had an identical error that was recently fixed:

https://ops4j1.jira.com/browse/PAXLOGGING-169
Post by Seth Leger (JIRA)
ThrowableProxy fails if sun.reflect.misc.Trampoline is in logged stack trace
----------------------------------------------------------------------------
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
Environment: Java 1.7u60, Java 1.7u25
Reporter: Seth Leger
Priority: Blocker
Attachments: Log4j2MethodUtilTrampolineTest.java, 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)
Gary Gregory (JIRA)
2014-09-16 19:14:35 UTC
Permalink
[ https://issues.apache.org/jira/browse/LOG4J2-832?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14136005#comment-14136005 ]

Gary Gregory commented on LOG4J2-832:
-------------------------------------

Would you be willing to clone from git our master branch and try the 2.1 code base?

Gary
Post by Seth Leger (JIRA)
ThrowableProxy fails if sun.reflect.misc.Trampoline is in logged stack trace
----------------------------------------------------------------------------
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
Environment: Java 1.7u60, Java 1.7u25
Reporter: Seth Leger
Priority: Blocker
Attachments: Log4j2MethodUtilTrampolineTest.java, 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)
Seth Leger (JIRA)
2014-09-16 19:23:35 UTC
Permalink
[ https://issues.apache.org/jira/browse/LOG4J2-832?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14136032#comment-14136032 ]

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

Hi Gary, I'm importing your code now to work on a patch. I'll also try the latest 2.1 code to see if the same error occurs.
Post by Seth Leger (JIRA)
ThrowableProxy fails if sun.reflect.misc.Trampoline is in logged stack trace
----------------------------------------------------------------------------
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
Environment: Java 1.7u60, Java 1.7u25
Reporter: Seth Leger
Priority: Blocker
Attachments: Log4j2MethodUtilTrampolineTest.java, 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)
Seth Leger (JIRA)
2014-09-16 20:10:34 UTC
Permalink
[ https://issues.apache.org/jira/browse/LOG4J2-832?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Seth Leger updated LOG4J2-832:
------------------------------
Attachment: LOG4J2-832.patch

The problem also occurs in the latest master code.

I think that this patch will fix the issue. It changes some specific ClassNotFoundException catch clauses to catch Throwable so that the java.lang.Error thrown by sun.reflect.misc.Trampoline will be caught. This fixes the attached unit test.

The patch applies against version 2.0.2 and the latest master code.
Post by Seth Leger (JIRA)
ThrowableProxy fails if sun.reflect.misc.Trampoline is in logged stack trace
----------------------------------------------------------------------------
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
Environment: Java 1.7u60, Java 1.7u25
Reporter: Seth Leger
Priority: Blocker
Attachments: LOG4J2-832.patch, Log4j2MethodUtilTrampolineTest.java, 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)
Gary Gregory (JIRA)
2014-09-16 22:51:34 UTC
Permalink
[ https://issues.apache.org/jira/browse/LOG4J2-832?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gary Gregory updated LOG4J2-832:
--------------------------------
Attachment: ggregory-log4j2.patch

The patch {{C:\test\ggregory-log4j2.patch}} only changes one catch and causes the test to pass. Could there be unforeseen problems catching Throwable instead of Exception here?
Post by Seth Leger (JIRA)
ThrowableProxy fails if sun.reflect.misc.Trampoline is in logged stack trace
----------------------------------------------------------------------------
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
Environment: Java 1.7u60, Java 1.7u25
Reporter: Seth Leger
Priority: Blocker
Attachments: LOG4J2-832.patch, Log4j2MethodUtilTrampolineTest.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)
Gary Gregory (JIRA)
2014-09-16 22:53:34 UTC
Permalink
[ https://issues.apache.org/jira/browse/LOG4J2-832?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14136425#comment-14136425 ]

Gary Gregory commented on LOG4J2-832:
-------------------------------------

The other issue is that the test depends on running on an Oracle VM. There should be a way to do the test with reflection...
Post by Seth Leger (JIRA)
ThrowableProxy fails if sun.reflect.misc.Trampoline is in logged stack trace
----------------------------------------------------------------------------
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
Environment: Java 1.7u60, Java 1.7u25
Reporter: Seth Leger
Priority: Blocker
Attachments: LOG4J2-832.patch, Log4j2MethodUtilTrampolineTest.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)
Gary Gregory (JIRA)
2014-09-16 22:55:34 UTC
Permalink
[ https://issues.apache.org/jira/browse/LOG4J2-832?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gary Gregory updated LOG4J2-832:
--------------------------------
Attachment: ggregory-log4j2-test.patch
Post by Seth Leger (JIRA)
ThrowableProxy fails if sun.reflect.misc.Trampoline is in logged stack trace
----------------------------------------------------------------------------
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
Environment: Java 1.7u60, Java 1.7u25
Reporter: Seth Leger
Priority: Blocker
Attachments: LOG4J2-832.patch, Log4j2MethodUtilTrampolineTest.java, ggregory-log4j2-test.patch, 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)
Gary Gregory (JIRA)
2014-09-16 22:55:33 UTC
Permalink
[ https://issues.apache.org/jira/browse/LOG4J2-832?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14136425#comment-14136425 ]

Gary Gregory edited comment on LOG4J2-832 at 9/16/14 10:54 PM:
---------------------------------------------------------------

The other issue is that the test depends on running on an Oracle VM. There should be a way to do the test with reflection... but the attached {{C:\test\ggregory-log4j2-test.patch}} passes when the fix is not applied which is not OK.


was (Author: garydgregory):
The other issue is that the test depends on running on an Oracle VM. There should be a way to do the test with reflection...
Post by Seth Leger (JIRA)
ThrowableProxy fails if sun.reflect.misc.Trampoline is in logged stack trace
----------------------------------------------------------------------------
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
Environment: Java 1.7u60, Java 1.7u25
Reporter: Seth Leger
Priority: Blocker
Attachments: LOG4J2-832.patch, Log4j2MethodUtilTrampolineTest.java, ggregory-log4j2-test.patch, 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)
Gary Gregory (JIRA)
2014-09-17 02:37:34 UTC
Permalink
[ https://issues.apache.org/jira/browse/LOG4J2-832?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gary Gregory updated LOG4J2-832:
--------------------------------
Attachment: (was: ggregory-log4j2.patch)
Post by Seth Leger (JIRA)
ThrowableProxy fails if sun.reflect.misc.Trampoline is in logged stack trace
----------------------------------------------------------------------------
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
Environment: Java 1.7u60, Java 1.7u25
Reporter: Seth Leger
Priority: Blocker
Attachments: LOG4J2-832.patch, Log4j2MethodUtilTrampolineTest.java, 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)
Gary Gregory (JIRA)
2014-09-17 02:37:34 UTC
Permalink
[ https://issues.apache.org/jira/browse/LOG4J2-832?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gary Gregory updated LOG4J2-832:
--------------------------------
Attachment: (was: ggregory-log4j2-test.patch)
Post by Seth Leger (JIRA)
ThrowableProxy fails if sun.reflect.misc.Trampoline is in logged stack trace
----------------------------------------------------------------------------
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
Environment: Java 1.7u60, Java 1.7u25
Reporter: Seth Leger
Priority: Blocker
Attachments: LOG4J2-832.patch, Log4j2MethodUtilTrampolineTest.java, 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)
Gary Gregory (JIRA)
2014-09-17 02:39:35 UTC
Permalink
[ https://issues.apache.org/jira/browse/LOG4J2-832?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gary Gregory updated LOG4J2-832:
--------------------------------
Attachment: ggregory-log4j2.patch

The new patch {{C:\test\ggregory-log4j2.patch}} works from Eclipse but I cannot get the Maven build to complete as it gets stuck in a Flume test. I've tried twice with the same result. Can anyone else try the patch? Also note that the unit test has some key lines commented out because it will not compile under Maven but compiles OK in Eclipse. This clearly needs some Maven magic; see the comments in the test class.
Post by Seth Leger (JIRA)
ThrowableProxy fails if sun.reflect.misc.Trampoline is in logged stack trace
----------------------------------------------------------------------------
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
Environment: Java 1.7u60, Java 1.7u25
Reporter: Seth Leger
Priority: Blocker
Attachments: LOG4J2-832.patch, Log4j2MethodUtilTrampolineTest.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)
Seth Leger (JIRA)
2014-09-17 10:33:33 UTC
Permalink
[ https://issues.apache.org/jira/browse/LOG4J2-832?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Seth Leger updated LOG4J2-832:
------------------------------
Attachment: Log4j2MethodUtilTrampolineTest.java

Here is an updated version of the test that runs under Maven by using reflection to instantiate MethodUtils and has additional comments.
Post by Seth Leger (JIRA)
ThrowableProxy fails if sun.reflect.misc.Trampoline is in logged stack trace
----------------------------------------------------------------------------
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
Environment: Java 1.7u60, Java 1.7u25
Reporter: Seth Leger
Priority: Blocker
Attachments: LOG4J2-832.patch, Log4j2MethodUtilTrampolineTest.java, Log4j2MethodUtilTrampolineTest.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)
Gary Gregory (JIRA)
2014-09-17 11:55:33 UTC
Permalink
[ https://issues.apache.org/jira/browse/LOG4J2-832?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14137109#comment-14137109 ]

Gary Gregory commented on LOG4J2-832:
-------------------------------------

[~soleger]: The new test is invalid because it passes when the bug is unpatched (when the code still catches Exception instead of Throwable).

That's the problem here, hard to prove there is a bug from a unit test, which we must have to make sure the fix does not get undone at some point in the future.
Post by Seth Leger (JIRA)
ThrowableProxy fails if sun.reflect.misc.Trampoline is in logged stack trace
----------------------------------------------------------------------------
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
Environment: Java 1.7u60, Java 1.7u25
Reporter: Seth Leger
Priority: Blocker
Attachments: LOG4J2-832.patch, Log4j2MethodUtilTrampolineTest.java, Log4j2MethodUtilTrampolineTest.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)
Seth Leger (JIRA)
2014-09-17 14:37:34 UTC
Permalink
[ https://issues.apache.org/jira/browse/LOG4J2-832?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14137331#comment-14137331 ]

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

What JDK are you using when the test passes? I think that this behavior was introduced in later patches for Java 6 and Java 7. According to this code in Java 7u40, they added a static initializer to Trampoline that is throwing the error that I see on my Java 7 system:

http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/7u40-b43/sun/reflect/misc/MethodUtil.java#MethodUtil

{code:java}
class Trampoline {
static {
if (Trampoline.class.getClassLoader() == null) {
throw new Error(
"Trampoline must not be defined by the bootstrap classloader");
}
}
...
}
{code}

Another person in my office is running the test on Java 6u65 and also gets an exception, although the exception is different (NoClassDefFoundError).
Post by Seth Leger (JIRA)
ThrowableProxy fails if sun.reflect.misc.Trampoline is in logged stack trace
----------------------------------------------------------------------------
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
Environment: Java 1.7u60, Java 1.7u25
Reporter: Seth Leger
Priority: Blocker
Attachments: LOG4J2-832.patch, Log4j2MethodUtilTrampolineTest.java, Log4j2MethodUtilTrampolineTest.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)
Matt Brozowski (JIRA)
2014-09-17 14:38:34 UTC
Permalink
[ https://issues.apache.org/jira/browse/LOG4J2-832?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14137333#comment-14137333 ]

Matt Brozowski commented on LOG4J2-832:
---------------------------------------

Here is the failure when running on Oracle Java 1.6.0

java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode)


{{noformat}}
-------------------------------------------------------------------------------
Test set: Log4j2MethodUtilTrampolineTest
-------------------------------------------------------------------------------
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.534 sec <<< FAILURE!
testTrampolineException(Log4j2MethodUtilTrampolineTest) Time elapsed: 0.506 sec <<< ERROR!
java.lang.NoClassDefFoundError: Could not initialize class sun.reflect.misc.Trampoline
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:171)
at org.apache.logging.log4j.core.util.Loader.loadClassWithDefaultClassLoader(Loader.java:272)
at org.apache.logging.log4j.core.util.Loader.loadClass(Loader.java:267)
at org.apache.logging.log4j.core.impl.ThrowableProxy.loadClass(ThrowableProxy.java:509)
at org.apache.logging.log4j.core.impl.ThrowableProxy.toExtendedStackTrace(ThrowableProxy.java:621)
at org.apache.logging.log4j.core.impl.ThrowableProxy.<init>(ThrowableProxy.java:170)
at org.apache.logging.log4j.core.impl.ThrowableProxy.<init>(ThrowableProxy.java:148)
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:189)
at org.apache.logging.log4j.core.layout.PatternLayout.toSerializable(PatternLayout.java:53)
at org.apache.logging.log4j.core.layout.AbstractStringLayout.toByteArray(AbstractStringLayout.java:52)
at org.apache.logging.log4j.core.appender.AbstractOutputStreamAppender.append(AbstractOutputStreamAppender.java:104)
at org.apache.logging.log4j.core.config.AppenderControl.callAppender(AppenderControl.java:97)
at org.apache.logging.log4j.core.config.LoggerConfig.callAppenders(LoggerConfig.java:428)
at org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:407)
at org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:365)
at org.apache.logging.log4j.core.Logger.logMessage(Logger.java:112)
at org.apache.logging.log4j.spi.AbstractLogger.logMessage(AbstractLogger.java:1336)
at org.apache.logging.log4j.spi.AbstractLogger.logIfEnabled(AbstractLogger.java:1325)
at org.apache.logging.log4j.spi.AbstractLogger.error(AbstractLogger.java:551)
at Log4j2MethodUtilTrampolineTest.testTrampolineException(Log4j2MethodUtilTrampolineTest.java:61)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:53)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:123)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:104)

{{noformat}}
Post by Seth Leger (JIRA)
ThrowableProxy fails if sun.reflect.misc.Trampoline is in logged stack trace
----------------------------------------------------------------------------
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
Environment: Java 1.7u60, Java 1.7u25
Reporter: Seth Leger
Priority: Blocker
Attachments: LOG4J2-832.patch, Log4j2MethodUtilTrampolineTest.java, Log4j2MethodUtilTrampolineTest.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)
Matt Brozowski (JIRA)
2014-09-17 14:39:33 UTC
Permalink
[ https://issues.apache.org/jira/browse/LOG4J2-832?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14137333#comment-14137333 ]

Matt Brozowski edited comment on LOG4J2-832 at 9/17/14 2:38 PM:
----------------------------------------------------------------

Here is the failure when running on Oracle Java 1.6.0

java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode)


{noformat}
-------------------------------------------------------------------------------
Test set: Log4j2MethodUtilTrampolineTest
-------------------------------------------------------------------------------
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.534 sec <<< FAILURE!
testTrampolineException(Log4j2MethodUtilTrampolineTest) Time elapsed: 0.506 sec <<< ERROR!
java.lang.NoClassDefFoundError: Could not initialize class sun.reflect.misc.Trampoline
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:171)
at org.apache.logging.log4j.core.util.Loader.loadClassWithDefaultClassLoader(Loader.java:272)
at org.apache.logging.log4j.core.util.Loader.loadClass(Loader.java:267)
at org.apache.logging.log4j.core.impl.ThrowableProxy.loadClass(ThrowableProxy.java:509)
at org.apache.logging.log4j.core.impl.ThrowableProxy.toExtendedStackTrace(ThrowableProxy.java:621)
at org.apache.logging.log4j.core.impl.ThrowableProxy.<init>(ThrowableProxy.java:170)
at org.apache.logging.log4j.core.impl.ThrowableProxy.<init>(ThrowableProxy.java:148)
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:189)
at org.apache.logging.log4j.core.layout.PatternLayout.toSerializable(PatternLayout.java:53)
at org.apache.logging.log4j.core.layout.AbstractStringLayout.toByteArray(AbstractStringLayout.java:52)
at org.apache.logging.log4j.core.appender.AbstractOutputStreamAppender.append(AbstractOutputStreamAppender.java:104)
at org.apache.logging.log4j.core.config.AppenderControl.callAppender(AppenderControl.java:97)
at org.apache.logging.log4j.core.config.LoggerConfig.callAppenders(LoggerConfig.java:428)
at org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:407)
at org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:365)
at org.apache.logging.log4j.core.Logger.logMessage(Logger.java:112)
at org.apache.logging.log4j.spi.AbstractLogger.logMessage(AbstractLogger.java:1336)
at org.apache.logging.log4j.spi.AbstractLogger.logIfEnabled(AbstractLogger.java:1325)
at org.apache.logging.log4j.spi.AbstractLogger.error(AbstractLogger.java:551)
at Log4j2MethodUtilTrampolineTest.testTrampolineException(Log4j2MethodUtilTrampolineTest.java:61)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:53)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:123)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:104)

{noformat}


was (Author: brozow):
Here is the failure when running on Oracle Java 1.6.0

java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode)


{{noformat}}
-------------------------------------------------------------------------------
Test set: Log4j2MethodUtilTrampolineTest
-------------------------------------------------------------------------------
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.534 sec <<< FAILURE!
testTrampolineException(Log4j2MethodUtilTrampolineTest) Time elapsed: 0.506 sec <<< ERROR!
java.lang.NoClassDefFoundError: Could not initialize class sun.reflect.misc.Trampoline
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:171)
at org.apache.logging.log4j.core.util.Loader.loadClassWithDefaultClassLoader(Loader.java:272)
at org.apache.logging.log4j.core.util.Loader.loadClass(Loader.java:267)
at org.apache.logging.log4j.core.impl.ThrowableProxy.loadClass(ThrowableProxy.java:509)
at org.apache.logging.log4j.core.impl.ThrowableProxy.toExtendedStackTrace(ThrowableProxy.java:621)
at org.apache.logging.log4j.core.impl.ThrowableProxy.<init>(ThrowableProxy.java:170)
at org.apache.logging.log4j.core.impl.ThrowableProxy.<init>(ThrowableProxy.java:148)
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:189)
at org.apache.logging.log4j.core.layout.PatternLayout.toSerializable(PatternLayout.java:53)
at org.apache.logging.log4j.core.layout.AbstractStringLayout.toByteArray(AbstractStringLayout.java:52)
at org.apache.logging.log4j.core.appender.AbstractOutputStreamAppender.append(AbstractOutputStreamAppender.java:104)
at org.apache.logging.log4j.core.config.AppenderControl.callAppender(AppenderControl.java:97)
at org.apache.logging.log4j.core.config.LoggerConfig.callAppenders(LoggerConfig.java:428)
at org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:407)
at org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:365)
at org.apache.logging.log4j.core.Logger.logMessage(Logger.java:112)
at org.apache.logging.log4j.spi.AbstractLogger.logMessage(AbstractLogger.java:1336)
at org.apache.logging.log4j.spi.AbstractLogger.logIfEnabled(AbstractLogger.java:1325)
at org.apache.logging.log4j.spi.AbstractLogger.error(AbstractLogger.java:551)
at Log4j2MethodUtilTrampolineTest.testTrampolineException(Log4j2MethodUtilTrampolineTest.java:61)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:53)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:123)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:104)

{{noformat}}
Post by Seth Leger (JIRA)
ThrowableProxy fails if sun.reflect.misc.Trampoline is in logged stack trace
----------------------------------------------------------------------------
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
Environment: Java 1.7u60, Java 1.7u25
Reporter: Seth Leger
Priority: Blocker
Attachments: LOG4J2-832.patch, Log4j2MethodUtilTrampolineTest.java, Log4j2MethodUtilTrampolineTest.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)
Gary Gregory (JIRA)
2014-09-17 14:53:34 UTC
Permalink
[ https://issues.apache.org/jira/browse/LOG4J2-832?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14137352#comment-14137352 ]

Gary Gregory edited comment on LOG4J2-832 at 9/17/14 2:53 PM:
--------------------------------------------------------------

I am using:
{noformat}
java version "1.7.0_67"
Java(TM) SE Runtime Environment (build 1.7.0_67-b01)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)
{noformat}


was (Author: garydgregory):
I am using:
{code}
java version "1.7.0_67"
Java(TM) SE Runtime Environment (build 1.7.0_67-b01)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)
{code}
Post by Seth Leger (JIRA)
ThrowableProxy fails if sun.reflect.misc.Trampoline is in logged stack trace
----------------------------------------------------------------------------
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
Environment: Java 1.7u60, Java 1.7u25
Reporter: Seth Leger
Priority: Blocker
Attachments: LOG4J2-832.patch, Log4j2MethodUtilTrampolineTest.java, Log4j2MethodUtilTrampolineTest.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)
Gary Gregory (JIRA)
2014-09-17 14:53:34 UTC
Permalink
[ https://issues.apache.org/jira/browse/LOG4J2-832?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14137352#comment-14137352 ]

Gary Gregory commented on LOG4J2-832:
-------------------------------------

I am using:
{code}
java version "1.7.0_67"
Java(TM) SE Runtime Environment (build 1.7.0_67-b01)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)
{code}
Post by Seth Leger (JIRA)
ThrowableProxy fails if sun.reflect.misc.Trampoline is in logged stack trace
----------------------------------------------------------------------------
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
Environment: Java 1.7u60, Java 1.7u25
Reporter: Seth Leger
Priority: Blocker
Attachments: LOG4J2-832.patch, Log4j2MethodUtilTrampolineTest.java, Log4j2MethodUtilTrampolineTest.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)
Gary Gregory (JIRA)
2014-09-17 15:41:34 UTC
Permalink
[ https://issues.apache.org/jira/browse/LOG4J2-832?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14137352#comment-14137352 ]

Gary Gregory edited comment on LOG4J2-832 at 9/17/14 3:40 PM:
--------------------------------------------------------------

I am using:
{noformat}
java version "1.7.0_67"
Java(TM) SE Runtime Environment (build 1.7.0_67-b01)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)
{noformat}
and:
{noformat}
Apache Maven 3.2.3 (33f8c3e1027c3ddde99d3cdebad2656a31e8fdf4; 2014-08-11T16:58:10-04:00)
Maven home: C:\Java\apache-maven-3.2.3
Java version: 1.7.0_67, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.7.0_67\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"
{noformat}



was (Author: garydgregory):
I am using:
{noformat}
java version "1.7.0_67"
Java(TM) SE Runtime Environment (build 1.7.0_67-b01)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)
{noformat}
Post by Seth Leger (JIRA)
ThrowableProxy fails if sun.reflect.misc.Trampoline is in logged stack trace
----------------------------------------------------------------------------
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
Environment: Java 1.7u60, Java 1.7u25
Reporter: Seth Leger
Priority: Blocker
Attachments: LOG4J2-832.patch, Log4j2MethodUtilTrampolineTest.java, Log4j2MethodUtilTrampolineTest.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)
Gary Gregory (JIRA)
2014-09-17 15:45:35 UTC
Permalink
[ https://issues.apache.org/jira/browse/LOG4J2-832?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14137352#comment-14137352 ]

Gary Gregory edited comment on LOG4J2-832 at 9/17/14 3:45 PM:
--------------------------------------------------------------

I am using:
{noformat}
java version "1.7.0_67"
Java(TM) SE Runtime Environment (build 1.7.0_67-b01)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)
{noformat}
and:
{noformat}
Apache Maven 3.2.3 (33f8c3e1027c3ddde99d3cdebad2656a31e8fdf4; 2014-08-11T16:58:10-04:00)
Maven home: C:\Java\apache-maven-3.2.3
Java version: 1.7.0_67, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.7.0_67\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"
{noformat}
This is what I see when I run {{mvn clean test}}:
{noformat}
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.023 sec - in org.apache.logging.log4j.core.HostNameTest
Running org.apache.logging.log4j.core.impl.Log4j2MethodUtilTrampolineTest
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.logging.log4j.core.impl.Log4j2MethodUtilTrampolineTest.testTrampolineException(Log4j2MethodUtilTrampolineTest.java:65)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.junit.runners.Suite.runChild(Suite.java:127)
at org.junit.runners.Suite.runChild(Suite.java:26)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
at org.junit.runner.JUnitCore.run(JUnitCore.java:138)
at org.apache.maven.surefire.junitcore.JUnitCoreWrapper.createRequestAndRun(JUnitCoreWrapper.java:113)
at org.apache.maven.surefire.junitcore.JUnitCoreWrapper.executeEager(JUnitCoreWrapper.java:85)
at org.apache.maven.surefire.junitcore.JUnitCoreWrapper.execute(JUnitCoreWrapper.java:54)
at org.apache.maven.surefire.junitcore.JUnitCoreProvider.invoke(JUnitCoreProvider.java:134)
at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:200)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)
Caused by: java.lang.IllegalAccessException: Class sun.reflect.misc.Trampoline can not access a member of class org.apache.logging.log4j.core.impl.Log4j2MethodUtilTrampolineTest$AlwaysThrowsException with modifiers "public"
at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:109)
at java.lang.reflect.AccessibleObject.slowCheckMemberAccess(AccessibleObject.java:261)
at java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:253)
at java.lang.reflect.Method.invoke(Method.java:599)
at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:75)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:279)
... 39 more
ERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging only errors to the console.
11:44:07.649 [main] ERROR org.apache.logging.log4j.core.impl.Log4j2MethodUtilTrampolineTest - null
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_67]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[?:1.7.0_67]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.7.0_67]
at java.lang.reflect.Method.invoke(Method.java:606) ~[?:1.7.0_67]
at org.apache.logging.log4j.core.impl.Log4j2MethodUtilTrampolineTest.testTrampolineException(Log4j2MethodUtilTrampolineTest.java:65) [test-classes/:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_67]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[?:1.7.0_67]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.7.0_67]
at java.lang.reflect.Method.invoke(Method.java:606) ~[?:1.7.0_67]
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) [junit-4.11.jar:?]
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) [junit-4.11.jar:?]
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) [junit-4.11.jar:?]
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) [junit-4.11.jar:?]
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271) [junit-4.11.jar:?]
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70) [junit-4.11.jar:?]
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) [junit-4.11.jar:?]
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) [junit-4.11.jar:?]
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) [junit-4.11.jar:?]
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) [junit-4.11.jar:?]
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) [junit-4.11.jar:?]
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) [junit-4.11.jar:?]
at org.junit.runners.ParentRunner.run(ParentRunner.java:309) [junit-4.11.jar:?]
at org.junit.runners.Suite.runChild(Suite.java:127) [junit-4.11.jar:?]
at org.junit.runners.Suite.runChild(Suite.java:26) [junit-4.11.jar:?]
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) [junit-4.11.jar:?]
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) [junit-4.11.jar:?]
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) [junit-4.11.jar:?]
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) [junit-4.11.jar:?]
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) [junit-4.11.jar:?]
at org.junit.runners.ParentRunner.run(ParentRunner.java:309) [junit-4.11.jar:?]
at org.junit.runner.JUnitCore.run(JUnitCore.java:160) [junit-4.11.jar:?]
at org.junit.runner.JUnitCore.run(JUnitCore.java:138) [junit-4.11.jar:?]
at org.apache.maven.surefire.junitcore.JUnitCoreWrapper.createRequestAndRun(JUnitCoreWrapper.java:113) [surefire-junit47-2.17.jar:2.17]
at org.apache.maven.surefire.junitcore.JUnitCoreWrapper.executeEager(JUnitCoreWrapper.java:85) [surefire-junit47-2.17.jar:2.17]
at org.apache.maven.surefire.junitcore.JUnitCoreWrapper.execute(JUnitCoreWrapper.java:54) [surefire-junit47-2.17.jar:2.17]
at org.apache.maven.surefire.junitcore.JUnitCoreProvider.invoke(JUnitCoreProvider.java:134) [surefire-junit47-2.17.jar:2.17]
at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:200) [surefire-booter-2.17.jar:2.17]
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153) [surefire-booter-2.17.jar:2.17]
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103) [surefire-booter-2.17.jar:2.17]
Caused by: java.lang.IllegalAccessException: Class sun.reflect.misc.Trampoline can not access a member of class org.apache.logging.log4j.core.impl.Log4j2MethodUtilTrampolineTest$AlwaysThrowsException with modifiers "public"
at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:109) ~[?:1.7.0_67]
at java.lang.reflect.AccessibleObject.slowCheckMemberAccess(AccessibleObject.java:261) ~[?:1.7.0_67]
at java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:253) ~[?:1.7.0_67]
at java.lang.reflect.Method.invoke(Method.java:599) ~[?:1.7.0_67]
at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:75) ~[?:1.7.0_67]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_67]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[?:1.7.0_67]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.7.0_67]
at java.lang.reflect.Method.invoke(Method.java:606) ~[?:1.7.0_67]
at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:279) ~[?:1.7.0_67]
... 39 more
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.114 sec - in org.apache.logging.log4j.core.impl.Log4j2MethodUtilTrampolineTest
{noformat}



was (Author: garydgregory):
I am using:
{noformat}
java version "1.7.0_67"
Java(TM) SE Runtime Environment (build 1.7.0_67-b01)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)
{noformat}
and:
{noformat}
Apache Maven 3.2.3 (33f8c3e1027c3ddde99d3cdebad2656a31e8fdf4; 2014-08-11T16:58:10-04:00)
Maven home: C:\Java\apache-maven-3.2.3
Java version: 1.7.0_67, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.7.0_67\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"
{noformat}
Post by Seth Leger (JIRA)
ThrowableProxy fails if sun.reflect.misc.Trampoline is in logged stack trace
----------------------------------------------------------------------------
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
Environment: Java 1.7u60, Java 1.7u25
Reporter: Seth Leger
Priority: Blocker
Attachments: LOG4J2-832.patch, Log4j2MethodUtilTrampolineTest.java, Log4j2MethodUtilTrampolineTest.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)
Seth Leger (JIRA)
2014-09-17 18:29:33 UTC
Permalink
[ https://issues.apache.org/jira/browse/LOG4J2-832?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Seth Leger updated LOG4J2-832:
------------------------------
Environment: Java 1.7u67 Linux/OSX/Win7, Java 1.7u60 Linux, Java 1.7u25 Linux (was: Java 1.7u60, Java 1.7u25)

I have figured out why the test is working for you and not me. The issue is fixed in the latest log4j 2.1-SNAPSHOT code. My POM file runs the test against log4j 2.0.2 which does fail.

I have not figured out exactly which change in log4j master fixed the issue. I am a little worried because the catch() statements haven't been changed in ThrowableProxy so I wonder if a class could still trigger an exception here somehow.

I'm not sure what to do now. You can mark the bug as fixed in 2.1 but anyone using log4j 2.0.x could still encounter this issue unless a fix is backported and released in a 2.0.3 release.
Post by Seth Leger (JIRA)
ThrowableProxy fails if sun.reflect.misc.Trampoline is in logged stack trace
----------------------------------------------------------------------------
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
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, 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)
Seth Leger (JIRA)
2014-09-17 18:31:34 UTC
Permalink
[ https://issues.apache.org/jira/browse/LOG4J2-832?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14136115#comment-14136115 ]

Seth Leger edited comment on LOG4J2-832 at 9/17/14 6:31 PM:
------------------------------------------------------------

-The problem also occurs in the latest master code.- Update: I was inadvertently running the code against log4j 2.0.2. The issue has been fixed in the latest 2.1-SNAPSHOT code.

I think that this patch will fix the issue. It changes some specific ClassNotFoundException catch clauses to catch Throwable so that the java.lang.Error thrown by sun.reflect.misc.Trampoline will be caught. This fixes the attached unit test.

The patch applies against version 2.0.2 and the latest master code.


was (Author: soleger):
The problem also occurs in the latest master code.

I think that this patch will fix the issue. It changes some specific ClassNotFoundException catch clauses to catch Throwable so that the java.lang.Error thrown by sun.reflect.misc.Trampoline will be caught. This fixes the attached unit test.

The patch applies against version 2.0.2 and the latest master code.
Post by Seth Leger (JIRA)
ThrowableProxy fails if sun.reflect.misc.Trampoline is in logged stack trace
----------------------------------------------------------------------------
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
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, 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)
Gary Gregory (JIRA)
2014-09-17 19:14:34 UTC
Permalink
[ https://issues.apache.org/jira/browse/LOG4J2-832?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gary Gregory resolved LOG4J2-832.
---------------------------------
Resolution: Fixed

Reporter says master works.
Post by Seth Leger (JIRA)
ThrowableProxy fails if sun.reflect.misc.Trampoline is in logged stack trace
----------------------------------------------------------------------------
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
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, 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)
Gary Gregory (JIRA)
2014-09-17 19:14:34 UTC
Permalink
[ https://issues.apache.org/jira/browse/LOG4J2-832?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14137770#comment-14137770 ]

Gary Gregory commented on LOG4J2-832:
-------------------------------------

At this time, we are not planning a 2.0.3 release but 2.1 will be out in a few weeks at the latest.
Post by Seth Leger (JIRA)
ThrowableProxy fails if sun.reflect.misc.Trampoline is in logged stack trace
----------------------------------------------------------------------------
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
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, 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)
Seth Leger (JIRA)
2014-09-17 19:45:34 UTC
Permalink
[ https://issues.apache.org/jira/browse/LOG4J2-832?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Seth Leger reopened LOG4J2-832:
-------------------------------

I've written a new test that fails with the same error under 2.1-SNAPSHOT. I think that, in particular, the sun.reflect.misc.Trampoline class is working under 2.1-SNAPSHOT because of the way that the LoaderUtil code was rearranged. However, it is possible to write a simple class that causes log4j to crash when logging the stack trace. I'll attach a unit test for this condition now.
Post by Seth Leger (JIRA)
ThrowableProxy fails if sun.reflect.misc.Trampoline is in logged stack trace
----------------------------------------------------------------------------
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
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, 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)
Seth Leger (JIRA)
2014-09-17 19:51:34 UTC
Permalink
[ https://issues.apache.org/jira/browse/LOG4J2-832?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Seth Leger updated LOG4J2-832:
------------------------------
Attachment: Log4j2UninitializableClassTest.java

This test uses a class whose static initializer always throws java.lang.Error. If you try to log the Error stack trace that is generated when you load the class, than log4j fails because it is not catching the Error generated when reflecting the class.
Post by Seth Leger (JIRA)
ThrowableProxy fails if sun.reflect.misc.Trampoline is in logged stack trace
----------------------------------------------------------------------------
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
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)
Seth Leger (JIRA)
2014-09-17 19:53:33 UTC
Permalink
[ https://issues.apache.org/jira/browse/LOG4J2-832?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Seth Leger updated LOG4J2-832:
------------------------------
Affects Version/s: 2.1
Summary: ThrowableProxy fails if a class in logged stack trace throws java.lang.Error from initializer (was: ThrowableProxy fails if sun.reflect.misc.Trampoline is in logged stack trace)
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)
Seth Leger (JIRA)
2014-09-17 19:54:34 UTC
Permalink
[ 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}
Post by Seth Leger (JIRA)
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)
Gary Gregory (JIRA)
2014-09-17 20:48:35 UTC
Permalink
[ https://issues.apache.org/jira/browse/LOG4J2-832?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14137958#comment-14137958 ]

Gary Gregory commented on LOG4J2-832:
-------------------------------------

Can you add an Apache License 2.0 header to your latest .java file? That, or create a unified diff file. Thank you!
Post by Seth Leger (JIRA)
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)
Gary Gregory (JIRA)
2014-09-17 21:13:34 UTC
Permalink
[ https://issues.apache.org/jira/browse/LOG4J2-832?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gary Gregory resolved LOG4J2-832.
---------------------------------
Resolution: Fixed
Fix Version/s: 2.1

Pushed to master.
Please verify and close.
Thank you for your patience and diligence!

Gary
Post by Seth Leger (JIRA)
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
Fix For: 2.1
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)
Seth Leger (JIRA)
2014-09-17 21:31:36 UTC
Permalink
[ https://issues.apache.org/jira/browse/LOG4J2-832?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Seth Leger closed LOG4J2-832.
-----------------------------

All available tests that I have for this condition pass with the latest 2.1-SNAPSHOT code. Thanks for the quick response to this issue! :)
Post by Seth Leger (JIRA)
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
Fix For: 2.1
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)

Loading...