Why does logging use both logback-test.xml and logback.xml as the configuration file name?

1

By reading the logbook manual, in the configuration section , it says that it looks for the following configuration, in order:

  • logback-test.xml
  • logback.groovy
  • logback.xml
  • Why is the -test suffix? For me just having logback.xml makes sense. Why do I have to name the file?

        
    asked by anonymous 11.01.2018 / 23:53

    1 answer

    1

    Unit tests typically include the entire project in the classpath, including configuration files, including logback.xml .

    The unit test logging settings typically differ from the project logging configuration for production. A simple way to resolve this is to place the logback-test.xml file in the unitpath classpath. So, Logback will know when to choose the correct configuration file and the name will make it clear if you are using the production ( logback.xml ) or the test ( logback-test.xml ).

        
    12.01.2018 / 00:52