[logback-user] JBoss logback scan=true not reloading the changes automatically

ceki ceki at qos.ch
Fri Apr 12 08:51:32 CEST 2013


You should be aware of the fact that auto scan requires several logging 
requests. From the documentation [1]:

Behind the scenes, when you set the scan attribute to true, a 
TurboFilter called ReconfigureOnChangeFilter will be installed. 
TurboFilters are described in a later chapter. As a consequence, 
scanning is done "in-thread", that is any time a printing method of 
logger is invoked. For example, for a logger named myLogger, when you 
write "myLogger.debug("hello");", and if the scan attribute is set to 
true, then ReconfigureOnChangeFilter will be invoked. Moreover, the said 
filter will be invoked even if myLogger is disabled for the DEBUG level.

Given that ReconfigureOnChangeFilter is invoked every time any logger is 
invoked, regardless of logger level, ReconfigureOnChangeFilter is 
absolutely performance critical. So much so that in fact, the check 
whether the scan period has elapsed or not, is too costly in itself. In 
order to improve performance, ReconfigureOnChangeFilter is in reality 
"alive" only once every N logging operations. Depending on how often 
your application logs, the value of N can be modified on the fly by 
logback. By default N is 16, although it can go as high as 2^16 (= 
65536) for CPU-intensive applications.

In short, when a configuration file changes, it will be automatically 
reloaded but only after several logger invocations and after a delay 
determined by the scanning period.

[1] http://logback.qos.ch/manual/configuration.html#autoScan

On 12.04.2013 08:43, KNair wrote:
> Hi All,
> We are using logback as the logger in our application. The environment
> details are JBoss 5.1, logback logback 0.9.29 and SL4j 1.6.1. The
> application is in ear format. As per the document, i ve placed scan = true
> and specified a scan period. Now when i change the logger level when the
> application is running, it is not reloaded automatically even after the
> specified time interval. Once i restart the app server, the changes are
> detected.
> We tried <jmxConfigurator/> and then changed the levels using jmx console.
> That approach has worked fine and logger levels are changed dynamically.
> My requirement is to get a solution with out using jmx. so that when i
> change the level, it has to reflect with out restarting the server. My
> logback.xml is modelled as per the documentation site, i would like to know,
> if there is anything more specific to be done? I wanted to minimize the
> dependency of logback api in our code, so i am using sl4j as wrapper.  Any
> additional properties need to be set, other than scan=true?
> All the configuration properties are logged in the console when i start the
> server. It even logs, the reload time period which i ve given.
> Thanks for the help.
> K Nair
> --
> View this message in context: http://logback.10977.n7.nabble.com/JBoss-logback-scan-true-not-reloading-the-changes-automatically-tp11852.html
> Sent from the Users mailing list archive at Nabble.com.
> _______________________________________________
> Logback-user mailing list
> Logback-user at qos.ch
> http://mailman.qos.ch/mailman/listinfo/logback-user

65% of statistics are made up on the spot

More information about the Logback-user mailing list