[ https://issues.apache.org/jira/browse/LOG4J2-3498?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17532219#comment-17532219 ]
Gary D. Gregory commented on LOG4J2-3498: ----------------------------------------- It looks like your project uses Java 11 so the JRE should pickup nanos for Instant instances. This could be some weird combination of OS/JVM. > Timestamp lacks micro and nano second precision on linux > -------------------------------------------------------- > > Key: LOG4J2-3498 > URL: https://issues.apache.org/jira/browse/LOG4J2-3498 > Project: Log4j 2 > Issue Type: Bug > Reporter: Benjamin Tanguay > Priority: Minor > > Generating a timestamp with micro and nano seconds defined fails when the > operating system is linux. Instead of having the required precision, the log > pads the micro and nano seconds with zeros. Testing it between some > developpers, the code works properly on Windows and Mac and only fails on > Linux machines. > Our team has tested this internally and it seems that the problem is linked > to a bad interaction between Linux and the library. We've tested with > different JDK versions and vendors and the problem remained the same. The > problem also works in the same way whether we use a JsonLayout or a > PatternLayout to output the timestamp in the log. > > {*}Expected{*}: > A timestamp with the form: "timestamp":"2022-05-04T17:53:43.914{*}123456{*}Z" > {*}Actual{*}: > A timestamp with the form: "timestamp":"2022-05-04T17:53:43.914{*}000000{*}Z" > > I created a small project to reproduce the issue. Notice the script demo.sh > that allows you to build an alpine image, execute the code in docker and > output the log in the console. > [https://github.com/BenjaminTanguay/log4j-low-timestamp-precision-linux-demo] > -- This message was sent by Atlassian Jira (v8.20.7#820007)