AnsweredAssumed Answered

Mapped Diagnostic Context for Logging

Question asked by smirzai on Jul 5, 2013
Latest reply on Jul 5, 2013 by smirzai
We are deploying many mission critical applications. In case of an error, it is absolutely vital to have enough abundant amount of status information, so that operators could track the reason as soon as possible.
Even we need the log files to be read and analysed by a robot, so that the proper monitoring signal is fired.

But it is not a good idea to show so much information when they are not really needed. Mapped Diagnostic Context can be a good solution. by using MDC, developer sends more information to the logger. but what could be logged, can be configured by the operator.

More information could be found here:   http://logging.apache.org/log4j/2.x/manual/thread-context.html




Now these information are sent to the logger when available:
   Process Definition ID
   Process execution Id
   Business Key
   Task Id

the user can configure the output to show the above information as he needs. Something like:
   log4j.appender.FILE.layout.ConversionPattern=   %X{mdcProcessExecutionID}  %d{yyyy-MM-dd}-%t-%x-%-5p-%-10c:%m%n


I have created a sample implementation, to share with others, if this is the best way to do it.
And also a jira issue, to track the changes

Outcomes