Freewind
Freewind

Reputation: 198388

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?

Upvotes: 4

Views: 3245

Answers (1)

Kaushal
Kaushal

Reputation: 675

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.

Upvotes: 3

Related Questions