Enable on-the-fly changes to Logback without restarting XL product

Follow

Kenny Lim -

Scenario: You want to include additional logging or remove logging of certain libraries/classes but do not wish to restart your XL Deploy or XL Release for it to take effect.

In XL Deploy and XL Release, we use logback for logging, and it does support automatic reloading of configuration file upon modification. You can do that by adding the scan="true" attribute to your configuration element in conf/logback.xml.

<configuration scan="true"> 
    .... 
</configuration>

By default, with attribute scan="true" set,logback scans the configuration file automatically every minute. You can furthercustomize the frequency of the scanning by adding a scanPeriod attribute to the configuration element as well like this:

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

where scanPeriod is how often logback checks the conf/logback.xml file for changes.

Do note that you still need to restart XL Deploy or XL Release once after adding the attributes in the configuration file so that the auto scanning takes effect.


Source: https://logback.qos.ch/manual/configuration.html

Have more questions? Submit a request