JBoss Community

Re: Logging with slf4j in 7.1.0.Final

created by David Lloyd in JBoss AS 7 Development - View the full discussion

Dan D wrote:

 

Hi David,

 

Regarding the use of log4j appenders, I asked this question a couple months ago in the forum and the general response I received was that I would have to create a custom appender.

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

 

The custom appenders required you to implement a JUL interface, which had no support for MDC. Maybe this has changed since then?

 

Are there any up to date articles or discussions that demonstrate how to use a a log4j appender in conjunction with the jboss logging?

 

Thanks,

Dan

 

You should be able to simply specify a log4j appender as a custom handler.  The code is supposed to detect that it's a log4j appender and automatically adapt it.

 

That said, you can also extend the "org.jboss.logmanager.ExtHandler" base class to get full capabilities for handling MDC and so on.  It does this by using our ExtLogRecord class which includes everything that log4j has that JUL is missing, including MDC.

Reply to this message by going to Community

Start a new discussion in JBoss AS 7 Development at Community