logback / LOGBACK-1658 [Open] LayoutPattern does not support nanoseconds format
============================== 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-1658 ============================== Issue created ------------------------------ Bertrand Renuart created this issue on 13/Aug/22 4:11 PM Summary: LayoutPattern does not support nanoseconds format Issue Type: Bug Affects Versions: 1.3.0-beta0 Assignee: Logback dev list Components: logback-classic Created: 13/Aug/22 4:11 PM Environment: PatternLayout trims the event timestamp down to milliseconds precision irrespective of the configured pattern. For instance the following config: {code:java} <appender name="LOGBACK" class="ch.qos.logback.core.ConsoleAppender"> <encoder> <pattern>%date{dd-MM-yyyy'T'HH:mm:ss.n} - %msg%n</pattern> </encoder> </appender> {code} produces output like the following: {code:java} 13-08-2022T16:05:49.211000000 - A sample log message (0) 13-08-2022T16:05:49.213000000 - A sample log message (1) 13-08-2022T16:05:49.213000000 - A sample log message (2) 13-08-2022T16:05:49.213000000 - A sample log message (3) 13-08-2022T16:05:49.213000000 - A sample log message (4) 13-08-2022T16:05:49.213000000 - A sample log message (5){code} As you can see although the pattern asks for nanoseconds after the seconds only the millis are actually output with the nano parts set to zero. A quick look at the code reveals that the {{DateConverter}} gets the timestamp from the ILoggingEvent by calling {{ILoggingEvent#getTimeStamp()}} which gives the timestamp in millis instead of the new {{ILoggingEvent#getInstant()}}. See [https://github.com/qos-ch/logback/blob/master/logback-classic/src/main/java/ch/qos/logback/classic/pattern/DateConverter.java#L59-L62.|https://github.com/qos-ch/logback/blob/master/logback-classic/src/main/java/ch/qos/logback/classic/pattern/DateConverter.java#L59-L62] Priority: Major Reporter: Bertrand Renuart ============================== This message was sent by Atlassian Jira (v8.8.0#808000-sha1:e2c7e59) _______________________________________________ logback-dev mailing list logback-dev@qos.ch http://mailman.qos.ch/mailman/listinfo/logback-dev