Skip to content

Commit e1ba7d4

Browse files
committed
Use real timestamp in StatusLoggerExtension messages
1 parent 993f0a2 commit e1ba7d4

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
package org.apache.logging.log4j.test.junit;
1818

1919
import java.io.IOException;
20+
import java.time.Instant;
21+
import java.time.format.DateTimeFormatter;
2022
import java.util.ArrayList;
2123
import java.util.List;
2224
import java.util.stream.Stream;
@@ -132,9 +134,9 @@ public void handleException(final ExtensionContext context, final Throwable thro
132134
Level.ALL,
133135
false,
134136
false,
135-
true,
136137
false,
137-
"HH:mm:ss.SSS",
138+
false,
139+
null,
138140
ParameterizedNoReferenceMessageFactory.INSTANCE,
139141
PropertiesUtil.getProperties(),
140142
System.err);
@@ -143,7 +145,9 @@ public void handleException(final ExtensionContext context, final Throwable thro
143145
logger.atLevel(data.getLevel())
144146
.withThrowable(data.getThrowable())
145147
.withLocation(data.getStackTraceElement())
146-
.log(data.getMessage());
148+
.log("{} {}",
149+
DateTimeFormatter.ISO_LOCAL_TIME.format(Instant.ofEpochMilli(data.getTimestamp())),
150+
data.getMessage());
147151
});
148152
}
149153
}

0 commit comments

Comments
 (0)