use of org.apache.logging.log4j.core.lookup.JavaLookup in project logging-log4j2 by apache.
the class XmlLayoutTest method testAdditionalFields.
@Test
public void testAdditionalFields() throws Exception {
final AbstractJacksonLayout layout = XmlLayout.newBuilder().setLocationInfo(false).setProperties(false).setIncludeStacktrace(false).setAdditionalFields(new KeyValuePair[] { new KeyValuePair("KEY1", "VALUE1"), new KeyValuePair("KEY2", "${java:runtime}") }).setCharset(StandardCharsets.UTF_8).setConfiguration(ctx.getConfiguration()).build();
final String str = layout.toSerializable(LogEventFixtures.createLogEvent());
assertTrue(str, str.contains("<KEY1>VALUE1</KEY1>"));
assertTrue(str, str.contains("<KEY2>" + new JavaLookup().getRuntime() + "</KEY2>"));
}
Aggregations