这个问题在这里已经有了答案:
Where to place log4j.xml
(6 个回答)
5年前关闭。
我创建了一个 log4j util 类,我在其中使用
org.apache.log4j.xml.DOMConfigurator.configure("log4j.xml");
但是在测试时,它会抛出
log4j:ERROR Could not open [log4j.xml].
java.io.FileNotFoundException: log4j.xml (The system cannot find the file specified.)
at java.io.FileInputStream.<init>(FileInputStream.java:112)
at java.io.FileInputStream.<init>(FileInputStream.java:72)
谁能告诉我在哪里放置 log4j.xml 文件?
请您参考如下方法:
将它放在类路径中的根文件夹中。