use of org.apache.logging.log4j.jackson.AbstractJacksonLayout 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>"));
}
use of org.apache.logging.log4j.jackson.AbstractJacksonLayout in project logging-log4j2 by apache.
the class XmlLayoutTest method testIncludeNullDelimiterFalse.
@Test
public void testIncludeNullDelimiterFalse() throws Exception {
final AbstractJacksonLayout layout = XmlLayout.newBuilder().setCompact(true).setIncludeNullDelimiter(false).build();
final String str = layout.toSerializable(LogEventFixtures.createLogEvent());
assertFalse(str.endsWith("\0"));
}
Aggregations