log4j:警告找不到附加程序
我收到此警告,它会中断我的网络应用程序的运行。
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
对于小型独立程序和单元测试,我使用
BasicConfigurator
。初始化:
清理:
如果您使用 JUnit,通常应该记住将清理代码放在 @After/tearDown() 中,因为如果 log4j 已经初始化,configure() 方法会添加一个控制台附加程序。
For small stand-alone programs and unit tests, I use
BasicConfigurator
.To init:
To cleanup:
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.
那么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?