Log4j2属性| monitorInterval无法正常工作

tar*_*mar 5 java log4j log4j2

我正在使用log4j 2.4并尝试转换log4j2.xmllog4j.properties,但monitorInterval property似乎没有使用log4j2.properties.

  • status = trace
  • 名称= PropertiesConfig
  • property.filename = logs
  • appenders = console,file
  • 则monitorinterval = 10

虽然log4j2遵循文档 https://logging.apache.org/log4j/2.x/manual/configuration.html#Properties

显然是统计数据

属性配置文件支持广告商,monitorInterval,名称,包,shutdownHook,status

属性文件中的任何更改都不会导致重新加载日志记录配置.相反,它似乎完全有效xml format

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

每当我在.xml中进行任何更改时,我的log4j配置都被选中,并通过以下日志进行验证.

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]
Run Code Online (Sandbox Code Playgroud)

我还尝试将Log4j版本升级到2.5,但仍然观察到相同的行为.

Rem*_*pma 6

为了增加Ralph的答案,这在Log4j 2.6中得到了修复.相应的票证是https://issues.apache.org/jira/browse/LOG4J2-1263

请使用Log4j-2.6.1或更高版本.