Reputation: 731
Official documentation describes priorities for classpath configuration (test -> groovy -> xml -> Configurator SPI
) and mention the system property named logback.configurationFile
to specify external configuration. But what if the product contains the logback.xml on the classpath and user specify external config with logback.configurationFile
property. Which config will be loaded classpath or external?
Upvotes: 1
Views: 1356
Reputation: 681
Here is the full list from higher to lower priority:
logback.configurationFile
system property (only *.xml
and *.groovy
are accepted)logback-test.xml
from the classpathlogback.groovy
from the classpathlogback.xml
from the classpathConfigurator
implementation specified by META-INF/services/ch.qos.logback.classic.spi.Configurator
BasicConfigurator
(console appender)Source: logback ContextInitializer
v.1.2.6.
Upvotes: 1
Reputation: 731
At least for version 1.2.3 (latest stable version), the property has the highest priority. The configuration loaded in the ch.qos.logback.classic.util.ContextInitializer
class in findURLOfDefaultConfigurationFile
method
Upvotes: 1