ppkarwasz commented on code in PR #1964:
URL: https://github.com/apache/logging-log4j2/pull/1964#discussion_r1390431301


##########
log4j-api-test/src/main/java/org/apache/logging/log4j/test/junit/StatusLoggerExtension.java:
##########
@@ -146,10 +148,16 @@ public void handleException(final ExtensionContext 
context, final Throwable thro
                         .withThrowable(data.getThrowable())
                         .withLocation(data.getStackTraceElement())
                         .log("{} {}",
-                                
DateTimeFormatter.ISO_LOCAL_TIME.format(Instant.ofEpochMilli(data.getTimestamp())),
+                                formatLocalTime(data.getTimestamp()),
                                 data.getMessage());
             });
         }
+
+        private static String formatLocalTime(final long epochMilli) {
+            final Instant instant = Instant.ofEpochMilli(epochMilli);
+            final LocalDateTime localDateTime = 
LocalDateTime.ofInstant(instant, ZoneId.systemDefault());
+            return localDateTime.format(DateTimeFormatter.ISO_LOCAL_TIME);
+        }

Review Comment:
   Somehow I always get the time API wrong. It should be:
   ```
   
DateTimeFormatter.ISO_LOCAL_TIME.withZone(ZoneId.systemDefault()).format(Instant.ofEpochMilli(data.getTimestamp())),
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to