【发布时间】:2016-06-01 07:27:00
【问题描述】:
我们有一个 JAR,它在 Windows 中使用以下 log4J 参数从命令提示符运行:
-Dlog4.properties.file=C:/[folderName]/apps/[appName]/config/log4j.properties
即使 log4j.properties 文件确实在上面的路径中,log4j 也找不到它,因此无法正确配置,并且使用参数 -Dlog4j.debug 运行命令不会给出更多信息:
log4j: Trying to find [log4j.xml] using context classloader sun.misc.Launcher$Ap
pClassLoader@92e78c.
log4j: Trying to find [log4j.xml] using sun.misc.Launcher$AppClassLoader@92e78c
class loader.
log4j: Trying to find [log4j.xml] using ClassLoader.getSystemResource().
log4j: Trying to find [log4j.properties] using context classloader sun.misc.Laun
cher$AppClassLoader@92e78c.
log4j: Trying to find [log4j.properties] using sun.misc.Launcher$AppClassLoader@
92e78c class loader.
log4j: Trying to find [log4j.properties] using ClassLoader.getSystemResource().
log4j: Could not find resource: [null].
log4j:WARN No appenders could be found for logger (com.xxx.yyy.appName.Main).
log4j:WARN Please initialize the log4j system properly.
我觉得我缺少一些基本的东西,所以我对想法持开放态度......
【问题讨论】: