We have a huge legacy code with complex flow having sync and async operations. So we need to log an unique id for a specific request in all the log messages, where operations performed are running in different threads and that threads are in multiple execution context.
I tried using MDC and specifying -%X{req_id} in logger.xml and solution given in below mentioned blog by using custom akka dispatcher, but it doesn't works in multiple execution context, and also it does not work reliably in single execution context, where sometimes it returns req_id null. (http://yanns.github.io/blog/2014/05/04/slf4j-mapped-diagnostic-context-mdc-with-play-framework/)
Due to complex and huge code base its not possible to pass request id in every function call. Is there any way we can achieve this, with least changes? We need that request id in logs that are generated by play framework too.