Skip to content

JUnit Jupiter Extension to set up the jul-to-slf4j bridge in JUnit tests

License

Notifications You must be signed in to change notification settings

digipost/jul-to-slf4j-junit-extension

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Maven Central Build and deploy License

Digipost jul-to-slf4j bridge JUnit Extension

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.

About

JUnit Jupiter Extension to set up the jul-to-slf4j bridge in JUnit tests

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages