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

(TBD) Refactor Log4jLogEvent to lazily create ThrowableProxy

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0-beta5
    • 2.0-rc2
    • Core
    • None

    Description

      Background: during investigation of LOG4J2-245, several people raised performance concerns regarding ThrowableProxy. This issue is to separate that concern so that LOG4J2-245 can focus on resolving the EmptyStackException.

      ThrowableProxy does quite a bit of expensive-looking work to find the JAR file or directory where the class that threw the exception is located. This work is done for every event that contains an exception.
      However, this information is only used when the configuration contains either a RootThrowablePattern

      {"rEx", "rThrowable", "rException" }

      or an ExtendedThrowablePattern

      {"xEx", "xThrowable", "xException" }

      or when the LogEvent is serialized.

      I propose to change the Log4jLogEvent implementation: instead of unconditionally creating a ThrowableProxy object every time a log event contains an exception, only wrap this exception in a ThrowableProxy when either:

      • the getThrownProxy() method is called
      • the log event is serialized

      For reference, similar work has already been done on o.a.l.l.core.async.RingBufferLogEvent.

      Attachments

        Issue Links

          Activity

            People

              rpopma Remko Popma
              rpopma Remko Popma
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: