[play 2.2.x java] Logback MDC and Execution Context

155 views
Skip to first unread message

Rane Bowen

unread,
Jan 14, 2015, 7:42:54 PM1/14/15
to play-fr...@googlegroups.com
Hi there, 

I would like to be able to use MDC in our Logback logging, and I understand that there are some issues due to Logback using Threadlocal, and Play Framework. I've seen this thread: https://groups.google.com/forum/#!searchin/play-framework/logback$20mdc/play-framework/GhK2lwyrymM/WVLBgLuPetQJ and these implementations in Scala: http://yanns.github.io/blog/2014/05/04/slf4j-mapped-diagnostic-context-mdc-with-play-framework/

I must admit that my understanding of scala is limited, and I've been having trouble trying to port these solutions over to Java.  Has anyone else had any success?  Any tips?

Many thanks in advance.

Rane

Yann Simon

unread,
Jan 15, 2015, 2:53:43 AM1/15/15
to play-fr...@googlegroups.com
Hi

I am the author of the blog.
I have not tried to implement this in Java.
I think it is possible. You should check the Akka API, like this one: http://doc.akka.io/japi/akka/2.3.6/akka/dispatch/MessageDispatcherConfigurator.html

OR you can copy paste the scala code into a new scala project, make a jar, und put the jar into your libs.

In all cases, you'll need to make a jar. Otherwise you'll have problems in dev mode when play is started again.

Cheers,
Yann



--
You received this message because you are subscribed to the Google Groups "play-framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to play-framewor...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Rane Bowen

unread,
Jan 18, 2015, 6:13:31 PM1/18/15
to play-fr...@googlegroups.com
That's a great idea.  I'll give it a go.  Thank you!

Alan Alfredo Rojas Marroquin

unread,
Mar 23, 2015, 2:21:27 PM3/23/15
to play-fr...@googlegroups.com
Hi, 
could you port the code to Play Java.

Maybe you can help me with this. 

Thanks!
Reply all
Reply to author
Forward
0 new messages