本文介绍了为什么Log4j试图找到log4j.dtd的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试运行我的应用程序(在eclipse中)抱怨log4j.dtd时,我遇到异常。如果我使用log4j的xml配置,我的意思是有一个dtd文件吗?

I'm getting an exception when I try to run my application (in eclipse) complaining about log4j.dtd. Am I meant to have a dtd file if I use the xml configuration for log4j?

Caused by: java.io.FileNotFoundException:

    C:\data\workspace\LDICommon_Trunk\resources\log4j.dtd (The system cannot find the file specified)
        at java.io.FileInputStream.open(Native Method)


推荐答案

好的,我得到了问题的答案,事实证明,log4j不需要将dtd文件放在你的项目或机器中。

Ok, I got the answer to my problem, it turns out log4j doesn't need the dtd file to be located in your project or machine.

该错误是由eclipse试图运行log4j.xml文件引起的当我开始跑步时。
以前eclipse用于运行最后一次运行配置,现在它尝试运行编辑器中打开和关注的任何内容。事实上我的log4j.xml配置文件已经打开了,无论eclipse使用什么来运行xml文件都试图按照配置文件到达dtd。

The error was caused by eclipse trying to run the log4j.xml file when I launched a run.Previously eclipse used to run the last run configuration, now it tries to run whatever is open and in focus in the editor. And it just happened that my log4j.xml configuration file was open, and whatever eclipse uses to run an xml file was trying to get to the dtd as per the configuration file.

无论如何,非常感谢你的帮助。

Anyway, thanks a lot for your help.

这篇关于为什么Log4j试图找到log4j.dtd的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-29 19:46
查看更多