sgargan
sgargan

Reputation: 12638

Using MDC Logging in JBoss 6.1.0-Final

I'm having a lot of trouble using the MDC functionality of slf4j & Log4j in JBoss. My app uses the slf4j-1.6.1, the 1.2.16 version of log4j and the 6.1.0-Final version of JBoss. The MDC works fine in perf & test where Jetty is used but not in production where JBoss is the container. I've seen that other people have had trouble with log4j MDC and JBoss

https://community.jboss.org/thread/161799

And it mentions that this should be fixed in the 3.0.0.GA release of JBoss logging. I'm wondering if this is part of the 6.1.0-Final release? This Jira entry mentions that it should be.

https://issues.jboss.org/browse/JBAS-8807

I was wondering:

  1. How can I tell what version of logging is being used in 6.1.0-Final
  2. This page mentions that I could use JBoss logging explicitly https://community.jboss.org/wiki/UsingMDCInJBossAS6Applications

Should the JBoss libraries be bundled with the war for this (we bundle Hibernate in our war so this might be similar) or only used at compile time and 'provided' by JBoss?

Any help with this would be great.

Upvotes: 0

Views: 1522

Answers (1)

sgargan
sgargan

Reputation: 12638

On further investigation

1) There is a file in the root of the JBoss installatio, 'jar-versions.xml' file:

2) Bundling this in the war causes it to log MDC messages to the Jboss log. Note that a jboss-logging.xml is required to make it work correctly.

This is a good read for more info

https://community.jboss.org/wiki/UsingMDCInJBossAS6Applications?_sscc=t

Upvotes: 0

Related Questions