log4j.xml路径问题
我正在尝试使用 xml 配置让 log4j 工作。我已将 log4j.xml 添加到类路径中,但在运行时我收到:
log4j:WARN 找不到记录器 (test.DateFormatter) 的附加程序。 log4j:WARN 请正确初始化 log4j 系统。
如果我放置 log4j.properties ,它似乎会选择配置。 任何想法
I am trying to get log4j working using xml configuration. I have log4j.xml added to classpath but while running I am getting :
log4j:WARN No appenders could be found for logger (test.DateFormatter).
log4j:WARN Please initialize the log4j system properly.
If I place a log4j.properties instead it seems to pick up the configuration.
Any ideas
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
类路径中最好有一个 log4j.xml,但它还必须提供正确的配置。因此,也许您发布了 log4j.xml 文件的内容,以便我们可以帮助您(也许记录器配置中存在拼写错误?)。
您还应该查看 log4j 手册。 “默认初始化过程”部分描述了 log4j 如何尝试查找初始化文件。
It's good to have a log4j.xml in the classpath but it also has to provide the correct configuration. So maybe you post the content of your log4j.xml file so we can help you (maybe typo in logger configuration?).
You should also have a look at the log4j manual. The section "Default Initialization Procedure" describes how log4j will try to find the initialization file.