Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to print configuration information of logback?

I have configuration the logback with specified custom logback.xml file, but the log it prints is not what I want.

This is my code to initial logback:

private void initLogBack() throws JoranException {
    JoranConfigurator configurator = new JoranConfigurator();
    configurator.setContext(createLogbackContext());
    configurator.doConfigure(mycustomLogbackConf);
}

I think it may read some unexpected "logback.xml" files from somewhere I don't know. Is there any way to print all the configuration information that logback used?

e.g.

  1. The configuration files it uses
  2. The loggers defined
  3. The debug levels defined

Is it possible?

like image 835
Freewind Avatar asked Oct 16 '25 20:10

Freewind


1 Answers

logback 1.0.4 version has a fix with which you can set debug level at jvm level by using a property

-Dlogback.debug=true

Reference: http://jira.qos.ch/browse/LOGBACK-527

Hope it helps.

like image 152
Kaushal Avatar answered Oct 18 '25 08:10

Kaushal