Uploaded image for project: 'logback'
  1. logback
  2. LOGBACK-1682

Allow to configure the clock that is used to generate timestamps

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 1.3.1
    • Fix Version/s: None
    • Component/s: logback-classic
    • Labels:
      None

      Description

      logback creates the timestamp of a LoggingEvent using:

      Instant instant = Clock.systemUTC().instant();
      initTmestampFields(instant);
      

      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?

        Attachments

          Activity

            People

            Assignee:
            logback-dev Logback dev list
            Reporter:
            alonso.gonzalez Alonso Gonzalez
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated: