Question

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.

Was it helpful?

Solution

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.

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top