log4j:警告找不到附加程序

发布于 2024-09-07 18:45:27 字数 251 浏览 2 评论 0原文

我收到此警告,它会中断我的网络应用程序的运行。

    log4j:WARN No appenders could be found for logger (smslib).
    log4j:WARN Please initialize the log4j system properly.

我的库中有 log4j JAR 文件。我已经删除它并再次添加......这个警告不断出现。

感谢您抽出时间,

I am receiving this warning which interrupts the running of my web application.

    log4j:WARN No appenders could be found for logger (smslib).
    log4j:WARN Please initialize the log4j system properly.

I have the log4j JAR file in my library. I have deleted it and added it again ... this warning keeps showing up.

Thanks for your time,

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(2

纵情客 2024-09-14 18:45:27

对于小型独立程序和单元测试,我使用BasicConfigurator

初始化:

BasicConfigurator.configure();

清理:

BasicConfigurator.resetConfiguration();

如果您使用 JUnit,通常应该记住将清理代码放在 @After/tearDown() 中,因为如果 log4j 已经初始化,configure() 方法会添加一个控制台附加程序。

For small stand-alone programs and unit tests, I use BasicConfigurator.

To init:

BasicConfigurator.configure();

To cleanup:

BasicConfigurator.resetConfiguration();

If you're using JUnit, you should generally remember to place the cleanup code in your @After/tearDown(), since the configure() method adds a console appender if log4j had already been initialized.

无边思念无边月 2024-09-14 18:45:27

那么log4j显然已经被发现了,否则它不可能这样警告你!

更可能缺少的是 log4j 配置。您可以通过多种方法在 Web 应用程序中执行此操作 - 您尝试如何?

Well log4j is clearly being found, otherwise it couldn't be warning you like this!

What's more likely to be missing is a log4j configuration. There are lots of ways you can do this in a web application - how are you trying?

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