[logback-dev] [JIRA] Updates for LOGBACK-1682: Allow to configure the clock that is used to generate timestamps

QOS.CH (JIRA) noreply-jira at qos.ch
Tue Sep 20 11:58:00 CEST 2022


logback / LOGBACK-1682 [Open]
Allow to configure the clock that is used to generate timestamps

==============================

Here's what changed in this issue in the last few minutes.
This issue has been created
This issue is now assigned to you.

View or comment on issue using this link
https://jira.qos.ch/browse/LOGBACK-1682

==============================
 Issue created
------------------------------

Alonso Gonzalez created this issue on 20/Sep/22 11:45 AM
Summary:              Allow to configure the clock that is used to generate timestamps
Issue Type:           Improvement
Affects Versions:     1.2.11, 1.3.1
Assignee:             Logback dev list
Components:           logback-classic
Created:              20/Sep/22 11:45 AM
Priority:             Major
Reporter:             Alonso Gonzalez
Description:
  logback creates the timestamp of a LoggingEvent using:
  {code:java}
  timeStamp = System.currentTimeMillis();
  {code}
  in 1.2.11 and 
  {code:java}
  Instant instant = Clock.systemUTC().instant();
  initTmestampFields(instant);
  {code}
  in 1.3.1.
  
  Thus the time of the server is used to generate the timestamp of an entry. In scenarios where this time is not correct, the application can not influence the timestamps.
  
  Log4j has a clock interface ({{org.apache.logging.log4j.core.util.Clock}}) that can be implemented to achieve this task. The clock implementation can apply offsets to the system time.
  
  Would it be possibe to use a configurable clock instead of Clock.systemUTC() in logback?


==============================
 This message was sent by Atlassian Jira (v8.8.0#808000-sha1:e2c7e59)



More information about the logback-dev mailing list