Uploaded image for project: 'Log4j 2'
  1. Log4j 2
  2. LOG4J2-832

ThrowableProxy fails if a class in logged stack trace throws java.lang.Error from initializer

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 2.0, 2.0.2, 2.1
    • Fix Version/s: 2.1
    • Component/s: Core
    • Labels:
      None
    • Environment:

      Java 1.7u67 Linux/OSX/Win7, Java 1.7u60 Linux, Java 1.7u25 Linux

      Description

      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.

        Attachments

        1. pom.xml
          1.0 kB
          Seth Leger
        2. Log4j2MethodUtilTrampolineTest.java
          1 kB
          Seth Leger
        3. LOG4J2-832.patch
          1 kB
          Seth Leger
        4. ggregory-log4j2.patch
          3 kB
          Gary Gregory
        5. Log4j2MethodUtilTrampolineTest.java
          2 kB
          Seth Leger
        6. Log4j2UninitializableClassTest.java
          1 kB
          Seth Leger

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                soleger Seth Leger
              • Votes:
                1 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: