【问题标题】:How to configure monitorInterval in log4j.properties in log4j1.6如何在log4j1.6的log4j.properties中配置monitorInterval
【发布时间】:2015-04-08 11:22:54
【问题描述】:

我需要为monitorInterval 进行 log4j 配置。 log4j.properties 怎么能做到这一点?

log4j.xml可以这样配置:

<Configuration monitorInterval="5">

log4j.properties 中的等价物是什么?

【问题讨论】:

    标签: java logging configuration log4j


    【解决方案1】:

    对于log4j2,您可以使用此properties 文件。

    name = MainLogging
    
    monitorInterval = 5
    
    appender.console.type = Console
    appender.console.name = STDOUT
    appender.console.layout.type = PatternLayout
    appender.console.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
    
    rootLogger.level = ERROR
    rootLogger.appenderRefs = stdout
    rootLogger.appenderRef.console.ref = STDOUT
    rootLogger.additivity = false
    

    【讨论】:

      【解决方案2】:

      等价物是configureAndWatch,在这里查看对称问题:

      How to implement "configureAndWatch" in log4j2

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-08-09
        • 2013-07-05
        • 2012-10-20
        • 2014-11-26
        相关资源
        最近更新 更多