1

Overriding the default logger in mule so that I have some custom details to be sent to the logger threadcontext every time before the log message is print. Especially before the default payloads are print.

2 Answers2

0

You should not override the Mule API package. Also if this is for Mule 4 -the version wasn't mentioned- you have to be aware that the threading model will probably not allow you to reuse the thread context. Potentially each message processor can execute in a separate thread.

As an alternative, I have seen people implementing their own logging connectors/modules to customize logging operation.

aled
  • 21,330
  • 3
  • 27
  • 34
  • how you do this? that would really solve the puzzle – Vijay L Marcelin Apr 07 '20 at 16:03
  • Just follow the instructions in the documentation to create a module: https://docs.mulesoft.com/mule-sdk/1.1/getting-started, then replace the operations by your own. – aled Apr 07 '20 at 21:04
0

Thumbrule - This class cannot be overridden

So probably we can have a custom transformer that initialises the thread context so that in a specific flow in mule, the successive flows will follow the rountine of that thread context with value set since a flow is considered as THREAD.

If you want to do this in a more enhanced way - We can go for creating Message Processor. Please refer to the link below:

https://docs.mulesoft.com/connector-devkit/3.9/creating-message-processors