Skip to content

Set Up ​

VersionMin runtime versionCompatible Java versionsDescription
3.1.24.6.0Java 17, Java 11Stable release with JSON Serializer for JDK 8 datatypes (improved error handling)
3.0.24.3.0Java 17, Java 11Made queue dependencies optional to reduce size
2.2.34.3.0Java 17, Java 11Compatibility and stability updates

Maven Central

1

Add Dependency to `pom.xml`

Use the latest JSON Logger version from Maven Central. Replace the version placeholder with the newest value available.

Copy and paste the following Maven dependency snippet into your Mule application pom.xml under <dependencies>:

xml
<dependency>
    <groupId>cloud.anypoint</groupId>
    <artifactId>json-logger</artifactId>
    <version>{version}</version>
    <classifier>mule-plugin</classifier>
</dependency>
2

Configure JSON Logger Global Element

Add a global JSON Logger configuration to your global.xml or flow file:

xml
<json-logger:config name="json-logger-config"
    environment="dev" applicationName="test-app" applicationVersion="1.0.0"
    disabledFields="content" contentFieldsDataMasking="password">

    <!-- Optional: Configure external destination -->
    <json-logger:external-destination>
        <json-logger:amq-destination queueOrExchangeDestination="logs-queue"
            clientId="{clientId}" clientSecret="{clientSecret}" />
    </json-logger:external-destination>
</json-logger:config>

Configuration Options:

  • Identifiers: Application name, version and environment
  • Masking Rules: Define fields to mask sensitive data in logs
  • External Destinations: Route logs to Anypoint MQ, JMS queues, or AMQP destinations
  • JSON Output: Customize JSON structure (simple changes)
3

Add JSON Logger Operation in Mule Flow

  1. Add a JSON Logger operation to your flow using Anypoint Studio, Anypoint Code Builder, or XML configuration.
  2. Configure the required message parameter and optional parameters as needed.

Released under the MIT License.