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

Allocation regression in simple log invocation

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 2.11.2
    • Fix Version/s: None
    • Component/s: Core
    • Labels:
      None

      Description

      A simple log.info("something") appears to cause allocation in 2.11.2.

      Same code in 2.10.0 cause no such allocation. 

      Stacktrace (tested using https://github.com/google/allocation-instrumenter): 

      at com.google.monitoring.runtime.instrumentation.AllocationRecorder.recordAllocation(AllocationRecorder.java:238)
      at java.base/java.time.Instant.create(Instant.java:413)
      at java.base/java.time.Instant.ofEpochSecond(Instant.java:330)
      at java.base/java.time.Clock$SystemClock.instant(Clock.java:558)
      at org.apache.logging.log4j.core.util.SystemClock.init(SystemClock.java:44)
      at org.apache.logging.log4j.core.time.MutableInstant.initFrom(MutableInstant.java:92)
      at org.apache.logging.log4j.core.impl.MutableLogEvent.initTime(MutableLogEvent.java:325)
      at org.apache.logging.log4j.core.impl.ReusableLogEventFactory.createEvent(ReusableLogEventFactory.java:81)
      at org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:404)
      at org.apache.logging.log4j.core.config.AwaitCompletionReliabilityStrategy.log(AwaitCompletionReliabilityStrategy.java:63)
      at org.apache.logging.log4j.core.Logger.logMessage(Logger.java:146)
      at org.apache.logging.log4j.spi.AbstractLogger.tryLogMessage(AbstractLogger.java:2170)
      at org.apache.logging.log4j.spi.AbstractLogger.logMessageTrackRecursion(AbstractLogger.java:2125)
      at org.apache.logging.log4j.spi.AbstractLogger.logMessageSafely(AbstractLogger.java:2108)
      at org.apache.logging.log4j.spi.AbstractLogger.logMessage(AbstractLogger.java:2002)
      at org.apache.logging.log4j.spi.AbstractLogger.logIfEnabled(AbstractLogger.java:1974)
      at org.apache.logging.log4j.spi.AbstractLogger.info(AbstractLogger.java:1311)
      at mycode.testLogNoAllocation(LogAllocationTest.java:23)

       

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              gbo3006 Gilad Bar Orion
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: