Gur*_*uru 5 java configuration logging log4j log4j2
我想在运行时在log4j2中关闭我的调试语句.根据文档,我们可以做到这一点.我将我的log4j.xml文件保存在默认包中,然后将jar放在其中.因为我无法使用Dlog4j.configuration =/path/to/log4j.xml修改jar我指定的xml文件.但是,这不起作用.我使用file:// uri尝试了所有组合的所有内容,但仍然没有选择xml.
指定配置文件位置的系统属性与 log4j-1.x 不同。在log4j2中,该属性是“log4j.configurationFile”。
因此,如果配置位于 jar 文件中,您将使用:
-Dlog4j.configurationFile=jar:file:///C:/path/to/jarfile.jar!/path/to/log4j2.xml
Run Code Online (Sandbox Code Playgroud)
(我假设您monitorInterval
的配置中有该设置,如下所示:http://logging.apache.org/log4j/2.x/manual/configuration.html#AutomaticReconfiguration)
归档时间: |
|
查看次数: |
5215 次 |
最近记录: |