icon-arrow icon-check icon-mail icon-phone icon-facebook icon-linkedin icon-youtube icon-twitter icon-cheveron icon-download icon-instagram play close close icon-arrow-uturn icon-calendar icon-clock icon-search icon-chevron-process icon-skills icon-knowledge icon-kite icon-education icon-languages icon-tools icon-experience icon-coffee-cup
Werken bij Integration & Application Talents
Blog 21/08/2019

End-to-end logging and message tracing in Mule 4

End-to-end logging and message tracing in Mule 4

A while ago, I have posted a blog about tracing messages using end-to-end-logging in Mule 3. However, since we are now building integrations in Mule 4, a new method was required for this purpose. Because the Mule Trace Connector we developed was strongly built on principles that are changed from Mule 3 to Mule 4 (like inbound- and outbound properties and the use of correlation ID’s), it was time for a whole new plugin.

Mike Heeren /
Integratie expert

Developing Mule 3 connectors vs. Mule 4 plugins

The major difference between developing custom plugins in Mule 3 and Mule 4, is that Mule 3 connectors were build using the Anypoint Connector DevKit. These connectors should be developed using Anypoint Studio, just like regular Mule projects.

In Mule 4, this has been replaced by the Mule SDK’s. When using the Java SDK, these projects are pure Maven and Java based, so they can be developed in any IDE you want. Also, this makes it much easier to unit test these plugins. This can now be done using JUnit. Mule also provided the MuleArtifactFunctionalTestCase class, which can be used to run a mock Mule flow during a JUnit test.

Mule Trace Plugin for Mule 4

The source and documentation of how to use and implement the Mule Trace Plugin in Mule 4 can be found in Bitbucket.

Using this plugin, you can log messages in a JSON format. The flow name and message- and correlation ID’s (that are generated by Mule, and are also accessible from the Mule flows) will be added to the log message as well.  You can also specify a phase, severity and optionally a Map of meta data when logging a message.

  "traceId": "30fb3e20-a40e-11e9-9bba-34f39ac37765",
  "phase": "START",
  "metaData": {"hello": "world"},
  "messageId": "30fb3e20-a40e-11e9-9bba-34f39ac37765_1601587777",
  "message": "Hello world!",
  "flow": "mule-trace-connector-exampleFlow"

When you have meta data that should be logged for all log messages in a (chain of) flow(s), it’s also possible to persist meta data, even across multiple Mule flows and even applications.

For more (technical) details, the plugin source, guidelines about the implementation and example implementation projects please have a look at the README.md file in the Bitbucket repository:


2 Reacties

Geef jouw mening

Reactie plaatsen

Reactie toevoegen

Jouw e-mailadres wordt niet openbaar gemaakt.


  • Geen HTML toegestaan.
  • Regels en alinea's worden automatisch gesplitst.
  • Web- en e-mailadressen worden automatisch naar links omgezet.
Mike Heeren /
Integratie expert

Wil je deel uitmaken van een groep gedreven en ambitieuze experts? Stuur ons jouw cv!