final byte[] result = layout.toByteArray(event);
assertEquals("org/apache/logging/log4j/core/layout/PatternLayoutTest Hello, world!", new String(result));
}
private void testUnixTime(String pattern) throws Exception {
final LoggerContext ctx = (LoggerContext) LogManager.getContext();
final PatternLayout layout = PatternLayout.newBuilder()
.withPattern(pattern + " %m")
.withConfiguration(ctx.getConfiguration())
.build();
final LogEvent event1 = new Log4jLogEvent(this.getClass().getName(), null,
"org.apache.logging.log4j.core.Logger", Level.INFO, new SimpleMessage("Hello, world 1!"), null);
final byte[] result1 = layout.toByteArray(event1);
assertEquals(event1.getTimeMillis() + " Hello, world 1!", new String(result1));