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

Avoid unnecessary Clock calls when TimestampMessage is logged

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 2.0.1
    • None
    • None

    Description

      The TimestampMessage interface was introduced in LOG4J2-53 and revised for AsyncLogger in LOG4J2-455.

      I've observed that Clock.currentTimeMillis is still called which should not be necessary.

      I have two patches, one which adds JUnit tests that demonstrate the unnecessary Clock calls, and one which fixes the issue for both AsyncLogger and "traditional" configurations.

      Attachments

        1. ClockBenchmark.java
          13 kB
          Scott Harrington
        2. ClockBenchmark-jdk1.6.0_31.txt
          35 kB
          Scott Harrington
        3. ClockBenchmark-jdk1.7.0_45.txt
          35 kB
          Scott Harrington
        4. LOG4J2-744.patch
          3 kB
          Scott Harrington
        5. LOG4J2-744-test.patch
          13 kB
          Scott Harrington

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            rpopma Remko Popma
            seh4nc Scott Harrington
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment