I have a 2-module pom and ideally I would like each submodule to have its own logback.xml file. But logback complains about finding more than one logback.xml files in the classpath. Although it seems as if this is not a problem and the right xml is picked up, I would like to know what is the best solution for this.
Thanks in advance!
If your module is a jar, to be included as a dependency by another module, you shouldn't really have a logback.xml - it's up to the user of the jar to decide their logging configuration. Nor should you list logback as a dependency, since the user should choose the logging implementation.
I assume one of your two modules depends on the other. So the dependent module should have the logback.xml, and the other shouldn't.
While unit-testing each module, you can put a logback-test.xml
in src/test/resources
and add logback as a test-scoped dependency. That way, it won't be listed as a dependency of the module and the logback xml file won't be exported.
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