I have to migrate an existing project from Log4j to Log4j2. The easiest way seems to use the Log4j 1.2 Bridge. This works fine, even the existing log4j.properties
file can be used.
The question that I have is:
log4j.properties
file be reloaded periodically at runtime, so that a restart of the application is not necessary after changing
the log4j.properties
file?In Log4j version 1.x this could be done using
PropertyConfigurator.configureAndWatch(fileName, 10000)
,
but it seems this does not work any longer using the bridge.
You can use the log4j1.monitorInterval
system property:
log4j1.monitorInterval=10
The value is in seconds.
The above mentioned property can be set in any property source, e.g. in log4j2.component.properties
file.