【问题标题】:Log4j reflecting configuration file changes?Log4j 反映配置文件更改?
【发布时间】:2011-03-31 14:59:04
【问题描述】:

如果我对 Log4j 配置文件进行了更改,我是否必须重新启动我的应用程序才能使更改生效,还是 Log4j 会注意到更改并重新配置自己?

它在某些情况下会这样做吗?

【问题讨论】:

    标签: java configuration log4j


    【解决方案1】:
    DOMConfigurator.configureAndWatch(log4jConfigurationFilePath, delayInmilisecond)
    

    您可以使用上述方法来反映 log4j 配置文件的更改,如果您更喜欢 xml ..如果您更喜欢属性文件,您可以使用 PropertConfigurator.configureAndWatch 方法。

    【讨论】:

    • PropertyConfigurator,如果您使用的是属性文件而不是 XML 文件。
    猜你喜欢
    • 2015-08-22
    • 1970-01-01
    • 2012-10-06
    • 2011-07-16
    • 1970-01-01
    • 2022-09-28
    • 2019-11-06
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多