Huong Dan Java Logger – Part 7 – Access Correlation Id from log message

Adding the Correlation Id to the log message will help us to identify which request is experiencing a problem in case our Mule ESB application fails.

I will use the Mapped Diagnostic Context of the Logging Framework to pass the Correlation Id’s information to the log message. You can refer to the concept of Mapped Diagnostic Context here.

To do this, we first declare a constant variable in the HuongDanJavaLoggerComponentConnector class, which acts as the key to pass the Correlation Id to the log message.

Then, in the Processor method, I would put the Correlation Id information as follows:

 

Add Comment