log4j 记录器消息不显示在 JBoss Web 应用程序上
我使用 Jboss 6,我的
static Logger logger = Logger.getLogger(Foo.class);
不显示任何内容
尝试将 log4 添加到我的项目中,将其删除,将 log4j 文件放在我的 main/resources 文件夹中,不放置 log4j 文件,也没有结果。
只有 System.Out 似乎可以工作,但它没有提供我想看到的所有信息
我什至看到 Hibernate 日志工作但不是我的
我缺少什么?
I use Jboss 6 and my
static Logger logger = Logger.getLogger(Foo.class);
displays nothing
Tried adding log4 to my project, removing it, placing a log4j file on my main/resources folder, placing no log4j file and no results.
Only System.Out seems to work, but it doesn't provide all the information I would like to see
I even see Hibernate log working but not mine
What am I missing?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
事实证明我的日志记录确实有效。 Hibernate 日志记录由 jboss 日志记录设置控制。
当我将 log4j 放在类文件夹旁边并将 log4j jar 与项目放在一起时,我的日志记录就开始工作
Turns out my logging does work. Hibernate logging is controlled by the jboss logging settings.
My logging began to work as soon as I placed the log4j on right next to the classes folder, and placing log4j jar with the project
JBoss AS 6 默认不再使用 log4j。
原因 log4j 1.2.x 被证明容易出现死锁和性能问题。
Google 建议提供大量有关在 JBoss AS 6 中使用 log4j 的链接:
你在哪里在jboss6中配置log4j设置
http://www.mastertheboss.com/ jboss-application-server/325-using-log4j-with-jboss-6.html
http://community.jboss.org/thread/154993
http://community.jboss.org/thread/160796
http:// Community.jboss.org/thread/159862
但我建议将应用程序从 log4j 切换到 slf4j,使用
jboss-6.0.0.Final/common/lib/slf4j-jboss-logmanager.jar
适配器并将所有日志配置放在单个 jboss-logging.xml。JBoss AS 6 doesn't use log4j by default anymore.
Cause log4j 1.2.x proved to be vulnerable to deadlocks and performance problems.
Google suggests plenty of links on using log4j with JBoss AS 6:
Where do you configure log4j settings in jboss6
http://www.mastertheboss.com/jboss-application-server/325-using-log4j-with-jboss-6.html
http://community.jboss.org/thread/154993
http://community.jboss.org/thread/160796
http://community.jboss.org/thread/159862
But I would suggest switching apps from log4j to slf4j, using
jboss-6.0.0.Final/common/lib/slf4j-jboss-logmanager.jar
adapter and having all logging configuration in single jboss-logging.xml.