cancel
Showing results for 
Search instead for 
Did you mean: 

MDC Log4j for Activiti Delegate Classes

spark2
Champ in-the-making
Champ in-the-making
We are using Log4j MDC for adding custom key-value pairs to be logged so that we can track each request in multi-threaded environment. For each web request we log request id (System nano sec + random number).

When application calls activiti workflow which in turn calls JavaDelegate, this MDC keys are lost and are not logged by Log4j. After troubleshooting I found that MDC are not passed to threads started by Thread Pool Executor. Activit is using thread pool executor for starting job threads.

What is the best way to address this? I would like MDC to be logged from JavaDelegate classes.

Environment: IBM WebSphere 7, Java 6, Activiti 5.12, Log4j 1.2.x
3 REPLIES 3

trademak
Star Contributor
Star Contributor
We added MDC support starting from Activiti 5.13.
Did you look at the user guide?

http://activiti.org/userguide/index.html#MDC


spark2
Champ in-the-making
Champ in-the-making
Currently we are using 5.12 and can upgrade in production only if absolutely necessary.
To confirm,
1) To enable MDC support we need to upgrade to 5.13 or higher version?
2) It supports custom MDC (we have request id, user name, etc) and not just listed in user guide.

Thanks!

jbarrez
Star Contributor
Star Contributor
1) yes

2) i don't believe so