In my maven project, I have one module depending on another, and it checks the code / resources:
... <scope>test</scope> <type>test-jar</type> ...
Now both modules have their own logback-test.xml, each of which has a specific configuration for running tests in this particular module. However, as expected, when running tests in the child module, the log blocks a warning that there are several logback-test.xml in the path, and does this with the default logging setting:
08:44:17,528 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.groovy] 08:44:17,530 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback-test.xml] at [file:path/to/my/project/module2/logback-test.xml] 08:44:17,532 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource [logback-test.xml] occurs multiple times on the classpath. 08:44:17,533 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource [logback-test.xml] occurs at [file:/C:/path/to/my/project/module2/logback-test.xml] 08:44:17,533 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource [logback-test.xml] occurs at [file:/C:/path/to/my/project/module1/logback-test.xml] 08:44:17,636 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - debug attribute not set 08:44:17,647 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender] 08:44:17,653 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [STDOUT] 08:44:17,692 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property 08:44:17,764 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to WARN 08:44:17,764 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [STDOUT] to Logger[ROOT] 08:44:17,765 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [com.myproject] to TRACE 08:44:17,765 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [ch.qos.logback] to OFF 08:44:17,768 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@5b0a485c - Registering current configuration as safe fallback point
I wonder how I can solve this problem. I want to save several configurations for each module; I think I cannot exclude one file from the classpath; I just want me to forget to shut up about the things that I know about. As you can see from the last two lines, I have the full log package set to “OFF” in my configuration, but it still goes to the log after this point. The log template is also different from what I configured in any configuration.
Redundancy is configured and used in code through SLF4J.
When tests are run in the parent module, none of them are registered (neither INFO nor WARN messages), so I can not blame him for anything other than the strange behavior of Logback.