logback with EJB3.1

Posted by kgrad on Stack Overflow See other posts from Stack Overflow or by kgrad
Published on 2010-03-10T15:24:14Z Indexed on 2010/03/13 0:17 UTC
Read the original article Hit count: 1121

Filed under:
|
|
|
|

I am using logback/slf4j to handle logging in my application. Everything was working perfectly until I started using EJBs. Once I added a stateless EJB to my app, the logger started ignoring my logback.xml and stopped using my appenders. I switched to a programmatic logger configuration to see what was wrong and now I am getting the following error when I try to use my logger within the EJB:

org.slf4j.impl.JDK14LoggerFactory cannot be cast to ch.qos.logback.classic.LoggerContext

stemming from the line:

LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();

Is there any special configuration necessary to get logback to work with EJBs? If it matters I am deploying on glassfish v3.

© Stack Overflow or respective owner

Related posts about java

Related posts about logback