简体   繁体   English

未找到 log4j.properties 文件

[英]log4j.properties File not found

I know this question was already asked but I can't find/understand my error message.我知道已经有人问过这个问题,但我无法找到/理解我的错误信息。 Here's the thing.事情是这样的。 I want to use log4j on an Apache Tomcat 8.5 with eclipse for a web application.我想在带有 Eclipse 的 Apache Tomcat 8.5 上将 log4j 用于 Web 应用程序。 So log4j works and I created a log4j.properties file.所以 log4j 工作,我创建了一个 log4j.properties 文件。 I placed it in my /src like it is recommended.我把它放在我的 /src 中,就像推荐的那样。 Now comes the confusing thing for me.现在让我感到困惑的事情来了。 I get an Error Message:我收到一条错误消息:

log4j:ERROR Could not read configuration file [log4j.properties]. log4j:ERROR 无法读取配置文件 [log4j.properties]。 java.io.FileNotFoundException: log4j.properties (Das System kann die angegebene Datei nicht finden) java.io.FileNotFoundException: log4j.properties (Das System kann die angegebene Datei nicht finden)

After this error, I get the log I am expecting, so is there maybe a place the compiler searches the file before it searches in the src folder or do I have to add any other dependency.在这个错误之后,我得到了我期望的日志,所以编译器在 src 文件夹中搜索之前是否有可能搜索文件的地方,或者我是否必须添加任何其他依赖项。

In addition, I'm not using Maven.此外,我没有使用 Maven。 THX谢谢

我认为你想把这个文件放在你的 src/main/resources 中,这样它就会自动出现在你的 maven 路径上。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM