Harold L. Brown
Harold L. Brown

Reputation: 9966

logback.xml not scanned anew

I've configured the logback.xml file to be scanned every 5 seconds.

<configuration debug="true" scanPeriod="5 seconds">
...

Unfortunately this doesn't happen. What could go wrong?

The logback.xml file resides on the classpath of the Tomcat server. It's not inside the web application. It's parsed correctly on startup. I'm starting the server with Eclipse.

Upvotes: 3

Views: 2246

Answers (2)

Harold L. Brown
Harold L. Brown

Reputation: 9966

Besides scan and scanPeriod another aspect has to be considered as well:

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.

For more information see http://logback.qos.ch/manual/configuration.html#autoScan.

Upvotes: 2

ivstas
ivstas

Reputation: 1233

I think you forgot to set the scan attribute:

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

Upvotes: 5

Related Questions