-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
Description
Currently Java 8 users do not have access to timestamps with sub-millisecond precision.
The only PreciseClock
implementation is only available in the SystemClock
implementation for JRE 9+.
Since that implementation does not use any JDK 9-specific feature, I propose to:
- Move the
SystemClock
implementation fromlog4j-core-java9
tolog4j-core
, overriding the current one. - Document its effects on garbage-free logging. The implementation of
init(MutableInstant)
:
logging-log4j2/log4j-core-java9/src/main/java/org/apache/logging/log4j/core/util/SystemClock.java
Lines 42 to 44 in 89c9b9f
public void init(final MutableInstant mutableInstant) { final Instant instant = java.time.Clock.systemUTC().instant(); mutableInstant.initFromEpochSecond(instant.getEpochSecond(), instant.getNano());
might create a newjava.time.Instant
instance for each log event, although I am pretty much convinced that the JRE will inline that instance, when the method becomes hot enough.