log4j日志信息不显示在JBoss webapp上[英] log4j Logger messages are not displayed on JBoss webapp

本文是小编为大家收集整理的关于log4j日志信息不显示在JBoss webapp上的处理/解决方法,可以参考本文帮助大家快速定位并解决问题,中文翻译不准确的可切换到English标签页查看源文。

问题描述

我使用jboss 6和我的

static Logger logger = Logger.getLogger(Foo.class);

什么都没有显示

尝试将log4添加到我的项目,将其删除,将log4j文件放在我的主/资源文件夹上,没有放置log4j文件,没有结果.

唯一的系统.

我什至看到冬眠日志起作用,但我

我缺少什么?

推荐答案

事实证明我的记录确实有效. Hibernate Logging由JBOSS记录设置控制.

将log4j放在类文件夹旁边的log4j并将log4j jar放置在项目

的情况下,我的记录开始工作

其他推荐答案

JBOSS AS 6默认情况下不使用Log4J. 原因log4j 1.2.x被证明为容易遇到死亡和绩效问题.

Google建议使用log4j与JBoss AS 6:

使用很多链接

您在jboss6 /p>

http:http:http://.

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 .

本文地址:https://www.itbaoku.cn/post/1574946.html

问题描述

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?

推荐答案

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 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.