log4j Logger messages are not displayed on JBoss w

2019-05-10 00:19发布

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?

2条回答
祖国的老花朵
2楼-- · 2019-05-10 00:39

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.

查看更多
一夜七次
3楼-- · 2019-05-10 00:52

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

查看更多
登录 后发表回答