use of org.apache.logging.log4j.core.time.MutableInstant in project logging-log4j2 by apache.
the class JsonTemplateLayoutTest method createLogEventAtInstant.
private static LogEvent createLogEventAtInstant(final String formattedInstant) {
final SimpleMessage message = new SimpleMessage("LogEvent at instant " + formattedInstant);
final long instantEpochMillis = Instant.parse(formattedInstant).toEpochMilli();
final MutableInstant instant = new MutableInstant();
instant.initFromEpochMilli(instantEpochMillis, 0);
return Log4jLogEvent.newBuilder().setLoggerName(LOGGER_NAME).setMessage(message).setInstant(instant).build();
}
Aggregations