log4j2-logstash-jsonevent-layout
log4j2-logstash-jsonevent-layout copied to clipboard
Test Failure - MDC Looks Like
Gradle suite > Gradle test > org.apache.logging.log4j.core.layout.LogStashJSONLayoutJacksonIT.BasicSimpleTest STANDARD_OUT [cut due to security, but I have 6 pair of key-values here for some reason...seemingly derived from my env]
Gradle suite > Gradle test > org.apache.logging.log4j.core.layout.LogStashJSONLayoutJacksonIT.BasicSimpleTest FAILED java.lang.AssertionError: Expected: "{"@version":"1","thread":"Test worker","level":"DEBUG","loggerName":"org.apache.logging.log4j.core.layout.LogStashJSONLayoutJacksonIT","message":"Test Message","endOfBatch":false,"loggerFqcn":"org.apache.logging.log4j.core.layout.LogStashJSONLayoutJacksonIT","contextMap":[{"key":"Foo","value":"Bar"},{"key":"A","value":"B"}]}" but: contextMap[]: Expected 2 values but got 6 at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20) at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:8) at org.apache.logging.log4j.core.layout.LogStashJSONLayoutJacksonIT.BasicSimpleTest(LogStashJSONLayoutJacksonIT.java:99)
Looks like the test just needs to be updated.
The extra values seem to come from the log4j2.xml that is in the test folder, I changed the expected value to match it and the test passed