2017-06-20 86 views
1

我想从绝对路径设置log4j2.xml(不能使用属性文件)。我用下面在web.xml PARAMS:如何在web.xml中设置log4j2.xml绝对路径

<context-param> 
     <param-name>log4jConfiguration</param-name> 
     <param-value>file:///etc/log4j2.xml</param-value> 
    </context-param> 

基于Apache的文件,它应该工作,但我得到以下错误:

ERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging only errors to the console.

而且,我设置log4jContextName和isLog4jContextSelectorNamed参数,但我得到错误呢。

当我使用log4j.properties(log4j 1.x)时,它完全工作。

回答

0

如果您从log4j 1.x切换到log4j2,则必须具有log4j2.xml而不是log4j.properties或log4j.xml