【发布时间】:2015-02-17 22:57:04
【问题描述】:
$ java -Dlog4j.configuration=file:///path/to/your/log4j2.xml -jar /path/to/your/jar_file.jar
写到控制台,你得到
ERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging only errors to the console.
但是,看起来配置文件已经找到并且无法解析:
log4j:WARN Continuable parsing error 2 and column 31
log4j:WARN Document root element "Configuration", must match DOCTYPE root "null".
log4j:WARN Continuable parsing error 2 and column 31
log4j:WARN Document is invalid: no grammar found.
log4j:ERROR DOM element is - not a <log4j:configuration> element.
log4j:WARN No appenders could be found for logger (kafka.utils.VerifiableProperties).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
【问题讨论】:
-
确保你的构建路径上没有多个 log4j 版本。看起来第一行是关于 log4j 2.x 和最后一个 log4j:WARN 和 log4j:ERROR 是从 log4j 1.x...他们有不同的配置..