I\'d like to be able to switch the bindings for SLF4J for unit testing over to the simple version, but it seems there is no easy way to config this. Basically, my built proj
A better approach is to facilitate your logging framework. Logback library for instance first searches for logback-test.xml
and if it is not available, it looks for logback.xml
. If you place logback-test.xml
in /src/test/resources
, it will be picked up for unit tests. In this file you configure console logging instead of file.
If you are still using Log4J, simply place log4j.xml
in /src/test/resources
- this folder is available on classpath before /src/main/resources
, so Log4J will use it instead of ordinary /src/main/resources
version, while still loading the latter version for final builds (/src/test/resources
isn't even available then).