Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想知道为什么我为桌面应用程序设置 log4j 配置的努力不起作用。这里的许多答案建议首先将设置 -Dlog4j.debug 设置为 VM,以进行调试。在命令行上这有效。当我将它放在运行/调试配置.../VM 参数字段中并单击调试时,控制台视图中没有显示任何内容(在我的配置后正确标记)。为什么?
附加信息:log4j.jar 在构建路径设置中,eclipse 版本是 indigo 20110909
如果您碰巧在使用 slf4j,并且尚未安装slf4j-log4j12-x.x.x.jar,那么-Dlog4j.debug无论 log4j 是否在类路径上,该标志都不会给出任何输出。slf4j 希望有一个后端记录器(由一个后端 jar 文件指定)。
slf4j-log4j12-x.x.x.jar
-Dlog4j.debug
在我替换slf4j-jdk14-x.x.x.jar为之后slf4j-log4j12-x.x.x.jar,一切正常。
slf4j-jdk14-x.x.x.jar