How can I determine what log configuration source Logback actually used?

后端 未结 4 1247
半阙折子戏
半阙折子戏 2020-12-24 06:01

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 loggi

4条回答
  •  北海茫月
    2020-12-24 06:38

    You can set a Java system property to output Logback debugging info:

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

    This is further explained by the Logback documentation for automatic status printing (very bottom mentions forcing status output) and the logback.statusListenerClass property:

    In the absence of status messages, tracking down a rogue logback.xml configuration file can be difficult, especially in production where the application source cannot be easily modified. To help identify the location of a rogue configuration file, you can set a StatusListener via the "logback.statusListenerClass" system property (defined below) to force output of status messages. The "logback.statusListenerClass" system property can also be used to silence output automatically generated in case of errors.

提交回复
热议问题