[logback-user] logback.xml and logback-test.xml

Ceki Gulcu ceki at qos.ch
Wed Oct 7 19:28:15 UTC 2015


Hi Truptim,

Logback's status messages will tell you which logback.xml file is being 
picked. Dump logback's internal status messages by adding the following 
code some where in your code:

    LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
     // print logback's internal status
     StatusPrinter.print(lc);

See link [1] below for more details.

Alternatively, add an "on console" status listener by defining the 
"logback.statusListenerClass" property when you launch java as in:

java 
-Dlogback.statusListenerClass=ch.qos.logback.core.status.OnConsoleStatusListener

See link [2] below for details.

I hope this helps,

--
Ceki

[1] http://logback.qos.ch/manual/configuration.html#automaticStatusPrinting
[2] http://logback.qos.ch/manual/configuration.html#logback.statusLC


On 10/7/2015 20:11, Trupti Mali wrote:
> Hi,
> This is my very first post to this mailing list.
>
> I need one help from logback users. I wanted to setup logback with two sets of config files. 1) for production and 2) for test
> hence referring to the instrucitons posted on logback website - I added logback-test.xml and logback.xml to my config file. I was expecting logback-test.xml to be picked up first over logback.xml . But at runtime only logback.xml is getting picked.  Can these two files coexist and can we still manage to get one of them picked during runtime and how?
>
> Help much appreciated.
>
> Thanks
> Trupti


More information about the logback-user mailing list