AnsweredAssumed Answered

Integrating MDC Logging into all Logging Messages

Question asked by miniscem on Feb 21, 2017
Latest reply on Sep 2, 2017 by lwoznicki

Hello, 

 

I would like to use a custom mdc logging pattern and with my own custom key and values to all messages logged within and outside the activiti engine without adding each custom property to the LogMDC context in every delegate or action listener.

 

I've implemented the solution suggested here:  https://community.alfresco.com/message/766907-mdc-logging-from-methods-called-with-spring-expression?q=log%20mdc, which will only log messages in mdc format within the command context. My implementation sets the adds the custom MDC logging (key, value) pairs within a class that implements ProcessEngineConfigurationConfigurer and calls the setcommandContextFactory() on the SpringProcessEngineConfiguration objects passed to processEngineConfigurationInitialized(). Is this the best place to set the command context? Second, are there any other places within the activiti engine startup lifecycle where I can set the MDC logging configuration so as to log with MDC context in all logging messages (up until this point I've been focusing on command contexts only)?

 

I've also read and successfully implemented the changes to log4j mentioned here: Activiti User Guide  

 

Any help would be greatly appreciated. 

Outcomes