Index: log4j-core/src/main/java/org/apache/logging/log4j/core/async/RingBufferLogEvent.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- log4j-core/src/main/java/org/apache/logging/log4j/core/async/RingBufferLogEvent.java (revision 1613338) +++ log4j-core/src/main/java/org/apache/logging/log4j/core/async/RingBufferLogEvent.java (revision ) @@ -30,7 +30,6 @@ import org.apache.logging.log4j.core.lookup.StrSubstitutor; import org.apache.logging.log4j.message.Message; import org.apache.logging.log4j.message.SimpleMessage; -import org.apache.logging.log4j.message.TimestampMessage; import org.apache.logging.log4j.util.Strings; import com.lmax.disruptor.EventFactory; @@ -201,10 +200,6 @@ @Override public long getTimeMillis() { - final Message msg = getMessage(); - if (msg instanceof TimestampMessage) { // LOG4J2-455 - return ((TimestampMessage) msg).getTimestamp(); - } return currentTimeMillis; } Index: log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLogger.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLogger.java (revision 1613338) +++ log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLogger.java (revision ) @@ -33,6 +33,7 @@ import org.apache.logging.log4j.core.util.Loader; import org.apache.logging.log4j.message.Message; import org.apache.logging.log4j.message.MessageFactory; +import org.apache.logging.log4j.message.TimestampMessage; import org.apache.logging.log4j.status.StatusLogger; import com.lmax.disruptor.BlockingWaitStrategy; @@ -270,7 +271,8 @@ // System.currentTimeMillis()); // CoarseCachedClock: 20% faster than system clock, 16ms gaps // CachedClock: 10% faster than system clock, smaller gaps + message instanceof TimestampMessage ? ((TimestampMessage) message).getTimestamp() : - clock.currentTimeMillis()); + clock.currentTimeMillis()); // LOG4J2-639: catch NPE if disruptor field was set to null after our check above try { Index: log4j-core/src/main/java/org/apache/logging/log4j/core/impl/Log4jLogEvent.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- log4j-core/src/main/java/org/apache/logging/log4j/core/impl/Log4jLogEvent.java (revision 1613338) +++ log4j-core/src/main/java/org/apache/logging/log4j/core/impl/Log4jLogEvent.java (revision ) @@ -98,7 +98,11 @@ this(loggerName, marker, loggerFQCN, level, message, t, createMap(properties), ThreadContext.getDepth() == 0 ? null : ThreadContext.cloneStack(), null, - null, clock.currentTimeMillis()); // LOG4J2-628 use log4j.Clock for timestamps + null, + // LOG4J2-628 use log4j.Clock for timestamps + // LOG4J2-744 unless TimestampMessage already has one + message instanceof TimestampMessage ? ((TimestampMessage) message).getTimestamp() : + clock.currentTimeMillis()); } /**