2017-06-20 90 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