Skip to content

Commit

Permalink
Use real timestamp in StatusLoggerExtension messages
Browse files Browse the repository at this point in the history
  • Loading branch information
ppkarwasz committed Oct 20, 2023
1 parent 993f0a2 commit e1ba7d4
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
package org.apache.logging.log4j.test.junit;

import java.io.IOException;
import java.time.Instant;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Stream;
Expand Down Expand Up @@ -132,9 +134,9 @@ public void handleException(final ExtensionContext context, final Throwable thro
Level.ALL,
false,
false,
true,
false,
"HH:mm:ss.SSS",
false,
null,
ParameterizedNoReferenceMessageFactory.INSTANCE,
PropertiesUtil.getProperties(),
System.err);
Expand All @@ -143,7 +145,9 @@ public void handleException(final ExtensionContext context, final Throwable thro
logger.atLevel(data.getLevel())
.withThrowable(data.getThrowable())
.withLocation(data.getStackTraceElement())
.log(data.getMessage());
.log("{} {}",
DateTimeFormatter.ISO_LOCAL_TIME.format(Instant.ofEpochMilli(data.getTimestamp())),
data.getMessage());
});
}
}
Expand Down

0 comments on commit e1ba7d4

Please sign in to comment.