more-log4j2-2.1.0 with improved test support has been released #4035
mlangc
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have invested quite some time writing an asynchronous HTTP appender, that can be used to push logs to various observability
platforms. This appender was released under the Apache License as part of more-log4j2-2.0.0 about 2 weeks ago. One of my personal use cases is ingesting logs from locally executed unit tests. And while that works nicely with the previous release already, I discovered two problems, that are addressed in more-log4j2-2.1.0:
more-log4j2for your tests. more-log4j2-2.1.0 addresses this problem by reimplementing the LogCaptor API for log4j2. A few small tweaks to yourlog4j2-test.xmland switching your imports fromnl.altindag.log.LogCaptortocom.github.mlangc.more.log4j2.captor.LogCaptorshould be enough. In some cases trivial refactorings might be necessary, since I didn't clone the nl.altindag.log.model classes, but choose to expose the log4j2 APIs directly.SpringBootPropertySourcegives itself a higher priority than the SystemPropertiesPropertySource and the EnvironmentPropertySource which are shipped withlog4j2. The new more-log4j2-junit-2.1.0 module addresses this problem for Junit tests, by providing a TestExecutionListener that flushesAsyncHttpAppenderinstances when testshave finished. This listener is installed automatically once on the runtime classpath.
Any feedback is highly appreciated.
Beta Was this translation helpful? Give feedback.
All reactions