Log4j 2
  1. Log4j 2
  2. LOG4J2-744

Avoid unnecessary Clock calls when TimestampMessage is logged

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.0.1
    • Component/s: None
    • Labels:
      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.

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

        Activity

        Scott Harrington created issue -
        Scott Harrington made changes -
        Field Original Value New Value
        Attachment LOG4J2-744.patch [ 12657763 ]
        Attachment LOG4J2-744-test.patch [ 12657764 ]
        Gary Gregory made changes -
        Summary Aviod unnecessary Clock calls when TimestampMessage is logged Avoid unnecessary Clock calls when TimestampMessage is logged
        Scott Harrington made changes -
        Attachment ClockBenchmark.java [ 12658224 ]
        Scott Harrington made changes -
        Attachment ClockBenchmark-jdk1.7.0_45.txt [ 12658225 ]
        Scott Harrington made changes -
        Attachment ClockBenchmark-jdk1.6.0_31.txt [ 12658226 ]
        Remko Popma made changes -
        Assignee Remko Popma [ remkop@yahoo.com ]
        Remko Popma made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        Remko Popma made changes -
        Status In Progress [ 3 ] Resolved [ 5 ]
        Fix Version/s 2.0.1 [ 12327381 ]
        Resolution Fixed [ 1 ]
        Scott Harrington made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Remko Popma
            Reporter:
            Scott Harrington
          • Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development