Enrich Logging MDC with process context

275 views
Skip to first unread message

johanne...@googlemail.com

unread,
Feb 22, 2016, 2:54:21 PM2/22/16
to camunda BPM platform contributors
Hello

I've written a small process plugin which allows to enrich the logging MDC with the current process context (processInstanceId, businessKey, activityId, processDefinitionId). It is especially useful if you log out to JSON and push the logs to ELK, because log entries like

{
...
"@mdc": {
"activityId": "validateVacationRequest",
"processInstanceId":"ef95ecf5-d0bb-11e5-bdc7-002314a4d3d9",
"businessKey":"2",
"processDefinitionId":"vacationRequest:1:173a5a58-d0bb-11e5-bdc7-002314a4d3d9"
}
}

are indexed by the fields in MDC.

You can find the code and a short documentation here:

https://github.com/kifj/camunda-wildfly-logging

It's more of a proof of concept and I've only tested it on JBoss Wildfly, but I would like to hear your feedback. Bernd Ruecker affirmed me there may be interest and it could be of general usage.

Cheers
Johannes

Bernd Rücker

unread,
Feb 22, 2016, 2:58:00 PM2/22/16
to camunda...@googlegroups.com
I like it :-)

And as Jo noted you can use that for a lot of logging frameworks which support MDC (like e.g. log4j). If you wander what MDC is best ask Google (e.g. http://www.javacodegeeks.com/2013/01/effective-logging-in-javajee-mapped-diagnostic-context.html).

-----Ursprüngliche Nachricht-----
Von: camunda...@googlegroups.com [mailto:camunda...@googlegroups.com]
Gesendet: Montag, 22. Februar 2016 20:54
An: camunda BPM platform contributors <camunda...@googlegroups.com>
Betreff: Enrich Logging MDC with process context
--
You received this message because you are subscribed to the Google Groups "camunda BPM platform contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email to camunda-bpm-d...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/camunda-bpm-dev/48c911ae-775e-4308-b1a3-9968efceadab%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages