Drop-in replacement for default Mule Logger that outputs a JSON structure based on a predefined JSON schema.
For these reasons and based on previous customer experiences, I created this generic Java SDK JSON Logger Connector.
As mentioned above, this is a Java SDK based Mule 4 connector. However, in order to maximize customization to each customer's requirements while avoiding steep Java SDK learning curves, you can easily modify the output JSON data structure as well as connector configuration by editing 2 simple JSON schemas provided under:
/json-logger/src/main/resources/schema/
In a nutshell, by defining the output JSON schema as well as providing some additional SDK specific details (e.g. default values, default expressions, etc.), we can dynamically generate a module that aligns to those schemas.
Add this dependency to your application pom.xml
<groupId>cloud.anypoint</groupId>
<artifactId>json-logger</artifactId>
<version>2.2.1</version>
<classifier>mule-plugin</classifier>
If you want to deploy JSON Logger to your organization's Exchange, you need to follow these steps:
groupId
in pom.xml to the org id of your target business group (instead of cloud.anypoint
).0.0.23
as of the time of writing):
<plugin>
<groupId>org.mule.tools.maven</groupId>
<artifactId>exchange-mule-maven-plugin</artifactId>
<version>${exchange.mule.maven.plugin.version}</version>
<executions>
<execution>
<id>validate</id>
<phase>validate</phase>
<goals>
<goal>exchange-pre-deploy</goal>
</goals>
</execution>
<execution>
<id>deploy</id>
<phase>deploy</phase>
<goals>
<goal>exchange-deploy</goal>
</goals>
</execution>
</executions>
</plugin>
<distributionManagement>
element to your pom.xml (note the eu1.
which is required only for the EU management plane):
<distributionManagement>
<repository>
<id>anypoint-exchange-v3</id>
<name>Anypoint Exchange V3</name>
<url>https://maven.[eu1.]anypoint.mulesoft.com/api/v3/organizations/${project.groupId}/maven</url>
<layout>default</layout>
</repository>
</distributionManagement>
Also make sure, you have your credentials set up in your settings.xml accordingly (matching the repository id in this snippet).
mvn clean deploy
Please also check these blogposts for more details:
PART 2: https://blogs.mulesoft.com/dev/api-dev/json-logging-in-mule-4/
Bug fixes:
New features:
Improvements:
More details in the coming blog post (stay tuned!)
New features:
Improvements:
This extension is based on code developed by Andres Ramirez. It is a custom connector and it is provided under open source license. It is not officially supported by MuleSoft/Salesforce or anyone else.