Gilad Bar Orion created LOG4J2-2626:
---------------------------------------

             Summary: Allocation regression in simple log invocation
                 Key: LOG4J2-2626
                 URL: https://issues.apache.org/jira/browse/LOG4J2-2626
             Project: Log4j 2
          Issue Type: Bug
          Components: Core
    Affects Versions: 2.11.2
            Reporter: Gilad Bar Orion


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]): 
{quote}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)

 
{quote}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to