Log4j 识别 logj4.debug,但不遵守 log4j.properties 设置?

Log4j recognized logj4.debug, but not respecting log4j.properties setting?

我是 运行 来自 Intellij 的测试用例,具有以下 jvm 参数

-Xmx2512m -XX:MaxPermSize=512m -Dlog4j.properties=log4j.mllib.properties -Dlog4j.debug

有趣的是

-Dlog4j.debug

属性 受到尊重,但是

-Dlog4j.properties is not.

证据?在输出日志文件中我们看到:

log4j: Trying to find [log4j.xml] using context classloader sun.misc.Launcher$AppClassLoader@560dd7a7.
log4j: Trying to find [log4j.xml] using sun.misc.Launcher$AppClassLoader@560dd7a7 class loader.
log4j: Trying to find [log4j.xml] using ClassLoader.getSystemResource().
log4j: Trying to find [log4j.properties] using context classloader sun.misc.Launcher$AppClassLoader@560dd7a7.
log4j: Using URL [file:/shared/pic/mllib/target/scala-2.10/test-classes/log4j.properties] for automatic log4j configuration.
log4j: Reading configuration from URL file:/shared/pic/mllib/target/scala-2.10/test-classes/log4j.properties
..

所以我们确实看到了 log4j 处理的冗长(调试级别)- 由 -Dlog4j.debug 表示。但是 -Dlog4j.properties 没有被尊重。

试试 -Dlog4j.configuration=file:/log4j.mllib.properties