Add global custom values to Play Framework logger

17 Aufrufe
Direkt zur ersten ungelesenen Nachricht

Emmanuel

ungelesen,
28.03.2017, 05:05:3528.03.17
an 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

Allen antworten
Antwort an Autor
Weiterleiten
0 neue Nachrichten