Logback Documentation says, auto scan works in conjuction with logging Operations i.e.
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.
is there any way to configure the value of 'N' in your xml OR by any other means.
A quick look at the source code (logback 1.1.3) inside the
ch.qos.logback.classic.turbo.ReconfigureOnChangeFilter
class reveals the following:The starting value of
N
is hardcoded as can be seen here:Short of changing the source code and recompiling a change to this constant yourself, the code doesn't provide any sort of configuration option to change this.
How the
mask
variable is used can be seen in this snippet of code:However, as the documentation suggests, this
mask
(orN
) value is adjusted dynamically by logback as it feels that it needs to in order to maintain decent performance.The documentation only talks about an upward adjustment of the value of
N
when it feels it needs it. But the code shows that it will also dynamically adjust the value downwards when it feels that the value ofN
is too high.Notice the following code which determines how it dynamically adjusts the value of
N
:That last condition is saying that, if the last check was performed more than 800 ms ago, then the value of
N
is too high, and needs to be adjusted down.Assuming you don't have very frequent logs, then you can expect that eventually the value of
mask
will be brought down to0
, change detection will no longer get skipped, and it will actually start honoring yourscan period
configuration as you would expect.