Skip to content

Commit 27ea08d

Browse files
committed
Fix formatter of StatusLoggerExtension
1 parent b4986fe commit 27ea08d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

log4j-api-test/src/main/java/org/apache/logging/log4j/test/junit/StatusLoggerExtension.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
import java.io.IOException;
2020
import java.time.Instant;
21+
import java.time.ZoneId;
2122
import java.time.format.DateTimeFormatter;
2223
import java.util.ArrayList;
2324
import java.util.List;
@@ -141,13 +142,12 @@ public void handleException(final ExtensionContext context, final Throwable thro
141142
PropertiesUtil.getProperties(),
142143
System.err);
143144
logger.error("Test {} failed.\nDumping status data:", context.getDisplayName());
145+
final DateTimeFormatter formatter = DateTimeFormatter.ISO_LOCAL_TIME.withZone(ZoneId.systemDefault());
144146
statusListener.getStatusData().forEach(data -> {
145147
logger.atLevel(data.getLevel())
146148
.withThrowable(data.getThrowable())
147149
.withLocation(data.getStackTraceElement())
148-
.log("{} {}",
149-
DateTimeFormatter.ISO_LOCAL_TIME.format(Instant.ofEpochMilli(data.getTimestamp())),
150-
data.getMessage());
150+
.log("{} {}", formatter.format(Instant.ofEpochMilli(data.getTimestamp())), data.getMessage());
151151
});
152152
}
153153
}

0 commit comments

Comments
 (0)