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.
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