Add global custom values to Play Framework logger

17 views
Skip to first unread message

Emmanuel

unread,
Mar 28, 2017, 5:05:35 AM3/28/17
to Play Framework
Hello !

I already asked the question on stackoverflow with no luck (http://stackoverflow.com/questions/42972478/add-global-custom-values-to-play-framework-logger), so I am trying here !

I have a cluster of different Akka actors, all using logback as logger. In the pure Akka actors startup, I can do this during the app initialization:

MDC.put("role", role)

role being a string representing the process main role (like "worker"), and all the logs will have this additional context values, helping the investigation.

One of the role is a frontend and uses Play framework to publish a REST API. In that case, I do not define an object extending App, and I do not know how/where to set global values like that, so that all logs emitted in the play application are marked with the role (and other additional things I want to put).


Thanks !

Emmanuel

Reply all
Reply to author
Forward
0 new messages