log4j has a property, log4j.debug
, which will helpfully provide the user with an indication of which configuration file was actually used to configure the logging system.
I haven't been able to find anything equivalent with the (otherwise superior) Logback logging framework. Is there any way to print (for diagnostic purposes) at runtime, which configuration file Logback used to bootstrap itself?
[edit] To clarify, I'd ideally like a solution that doesn't require me to modify the configuration file itself (since a badly assembled third-party JAR, for example, may be picked up incorrectly, and prior to my logback configuration XML).
You can set a Java system property to output Logback debugging info:
This is further explained by the Logback documentation for automatic status printing (very bottom mentions forcing status output) and the logback.statusListenerClass property:
Not very scientific, but it works if you just want a quick confirmation.
I simply changed the log entry pattern and observed whether or not it changed in my console/log file.
If you want to go deep into
Logback
, you can do the followingIt will print the
URL
of the loaded configuration file.you can set debug="true" in a loback.xml file that you control like this
and tho make sure that file is going to be used by logback add following VM argument when you start your program:
This does not really answer to your question but gives you a work around solution.