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

Allow to configure the clock that is used to generate timestamps

    XMLWordPrintable

Details

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • 1.3.1
    • logback-classic
    • 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

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

            Dates

              Created:
              Updated: