Domanda

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.

È stato utile?

Soluzione

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.

Altri suggerimenti

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top