When default configuration does not exists (logback.groovy, logback-test.xml, logback.xml), LogBack will read system property to get the configuration file location:

java -Dlogback.configurationFile=/path/to/config.xml com.stefanauwyang.ApplicationClass

 

LogBack can be configured to automatically detect the change in configuration file:

<configuration scan="true" scanPeriod="30 seconds" >
  ...
</configuration>

Without the scanPeriod attribute, default period 60 seconds will be set automatically.

LogBack provides a servlet to check the LogBack logging status:

<servlet>
  <servlet-name>ViewStatusMessages</servlet-name>
  <servlet-class>ch.qos.logback.classic.ViewStatusMessagesServlet</servlet-class>
</servlet>
<servlet-mapping>
  <servlet-name>ViewStatusMessages</servlet-name>
  <url-pattern>/lbClassicStatus</url-pattern>
</servlet-mapping>

We can also print LogBack status to console by configuring this listener through Java code.

LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory(); 
StatusManager statusManager = lc.getStatusManager();
OnConsoleStatusListener onConsoleListener = new OnConsoleStatusListener();
statusManager.add(onConsoleListener);

… or from config file …

<configuration>
  <statusListener class="ch.qos.logback.core.status.OnConsoleStatusListener" />
  ...
</configuration>