[logback-user] LoggingContext JNDI not working in Session EJB using Thread

miguel goyena miguel.goyena at gmail.com
Mon Dec 7 12:41:49 CET 2009


Hi everybody:

I'm starting using logback, and I have a strange behauvour of logback.

I'm using LoggingContextSelect JNDI.

My application es an ear deployed in JBOSS, with  three WAR and a EJB
session jar.

One of the servlet in a WAR uses the Sesssion EJB. In the EJB Session
Method I create a Thread, and start it

MandarMensajes threadException = new MandarMensajes(tipo,cuantos,cadaCuanto);
threadException.start();

In this thread the run method uses logback for logging.

Logger logger = LoggerFactory.getLogger(this);
logger.logDebug("Hola");

But the logger I get have a default context!!!!!!, not the context defined
in the JNDI.

Only happends this when a use the thread in the Session EJB. If I use the
MandarMensajes thread in the servlet everything is correct. If I get a
logger anywhere else in the EJB Session everything is correct. If I use
the run() method in the EJB Session everything is correct. Even if I get
the MDC objet when thread is executing, all the values I put in servlet
are there; but the context is default, so it never uses my
logback.xml!!!!.

I don't know if it is a logback bug, or if I'm doing something wrong

I don't know if I've explained myself correctly, sorry my english is poor

Thanks a lot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://qos.ch/pipermail/logback-user/attachments/20091207/5aaa593a/attachment.htm>


More information about the Logback-user mailing list