This is a JUnit Jupiter extension which will load the
jul-to-slf4j bridge handler
for tests, to get logging done using the java.util.logging
API routed to
SLF4J.
The preferred way to use this is to declare it as a test-dependency, and include
a junit-platform.properties
file in the classpath for your tests, e.g. in
src/test/resources/junit-platform.properties
:
junit.jupiter.extensions.autodetection.enabled=true
This will enable the extension to be automatically loaded by JUnit Jupiter, and you do not need to specify the extension in every test.
Alternatively, if extension autodetection can not be enabled for your project for any reason, the extension can be loaded using
@ExtendWith(JavaLoggingToSlf4JExtension.class)
The extension detects if the jul-to-slf4j bridge handler is already installed (e.g. by Spring Boot or other tooling which sets up the Slf4J stack), and will not reinstall the bridge handler in such case.