7
votes

I am using log4j 2.4 and trying to convert log4j2.xml to log4j.properties, however monitorInterval property doesn't seem to be working with log4j2.properties.

  • status = trace
  • name=PropertiesConfig
  • property.filename = logs
  • appenders = console, file
  • monitorInterval=10

though log4j2 following documentation https://logging.apache.org/log4j/2.x/manual/configuration.html#Properties

clearly stats that

Properties configuration files support the advertiser, monitorInterval, name, packages, shutdownHook, status

any changes in property file doesn't leads to reloading of logging configuration. On the contrary, it seems to be perfectly working in xml format

<Configuration status="TRACE" monitorInterval="5">

where whenever I do make any changes in .xml my log4j configuration is picked up and is verified via following log.

2016-06-17 14:43:17,267 Thread-5 DEBUG Reconfiguration started for context 1198108795 (org.apache.logging.log4j.core.LoggerContext@86be70a)
2016-06-17 14:43:17,268 Thread-5 DEBUG Not in a ServletContext environment, thus not loading WebLookup plugin.

2016-06-17 14:43:17,273 Thread-5 DEBUG Initializing configuration XmlConfiguration[location=/Users/userx/Desktop/logs/log4j2_prod.xml]

I also tried to upgrade Log4j version to 2.5 but still observe same behavior.

2

2 Answers

7
votes

To add to Ralph's answer, this was fixed in Log4j 2.6. The corresponding ticket is https://issues.apache.org/jira/browse/LOG4J2-1263

Please use Log4j-2.6.1 or later.

1
votes

This was a bug that has been fixed. I would suggest updating the latest log4j release.