My Maven project has about seven sub-modules. Six of them packages as JARs and one as WAR.
Should I create individual logback.xml config in each module? Or should I have a "common" module that all other modules depend on, and put one single logback.xml in there? Are there any other options?
Thanks.
All library JARs should use only slf4j-api dependency, and only a final application (in your case it is .war
) should contain logback dependency and its configuration.
For test purposes I think easier to make <scope>test</scope>
dependency to the slf4j-simple
, it is simpler to use, and usually good enough for test cases.
Assuming you wish to add logback.xml configuration file in the modules with jar packaging for testing purposes, then just place logback.xml under src/test/resources
folder in each module of type 'jar'.
As @kan mentioned, the slf4j binding, e.g. slf4j-simple or logback-classic, should be in the test scope.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With