log4j.xml文件的放置[英] log4j.xml file placement

本文是小编为大家收集整理的关于log4j.xml文件的放置的处理/解决方法,可以参考本文帮助大家快速定位并解决问题,中文翻译不准确的可切换到English标签页查看源文。

问题描述

我创建了一个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文件?

推荐答案

将其放在root文件夹中.

本文地址:https://www.itbaoku.cn/post/1574774.html

问题描述

i have created a log4j util class where i'm picking up the file using

org.apache.log4j.xml.DOMConfigurator.configure("log4j.xml");

but when testing, it throws

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)

Can anyone tell me where do i place the log4j.xml file?

推荐答案

Put it on the classpath, in the root folder.