首页 > 代码库 > log4j报错ERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging only errors to the console.

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

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

log4j版本:log4j-core-2.7.jar   log4j-api-2.7.jar

log4j2只支持xml和json两种格式的配置,所以配置log4j.properties时,是没有作用的。

log4j 2.0与以往的1.x有一个明显的不同,其配置文件只能采用.xml, .json或者 .jsn。在默认情况下,系统选择configuration文件的优先级如下:(classpath为scr文件夹)

  1. classpath下名为 log4j-test.json 或者log4j-test.jsn文件
  2. classpath下名为 log4j2-test.xml
  3. classpath下名为 log4j.json 或者log4j.jsn文件
  4. classpath下名为 log4j2.xml

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