log4j.xml路径问题

发布于 2024-10-03 02:58:50 字数 193 浏览 0 评论 0原文

我正在尝试使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

说不完的你爱 2024-10-10 02:58:50

类路径中最好有一个 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文