How to use MDC with playframework for java

48 views
Skip to first unread message

xiaob...@gmail.com

unread,
Oct 18, 2017, 1:37:41 AM10/18/17
to Play Framework
  1. MDC is not always working in playframework, as functions are executed in a managed thread pool.
  2. In such cases, it is recommended that MDC.getCopyOfContextMap() is invoked on the original (master) thread before submitting a task to the executor.
  3. But the thread pool is managed by playframework, I can't invokeMDC.getCopyOfContextMap() on the original thread.
  4. Are there some solutions for java? Thanks

doc...@paradigmadigital.com

unread,
Oct 19, 2017, 7:59:03 AM10/19/17
to Play Framework

I was facing the same problem before. I eventually stopped using MDC and moved to Markers as shown here:

https://www.playframework.com/documentation/2.6.x/JavaLogging#using-markers
Reply all
Reply to author
Forward
0 new messages