JSON Logger in MuleSoft

Published on
March 1, 2021
Author
MuleSoft Integration Team
JSON Logger in MuleSoft

Logging is one of the most fundamental yet overlooked element of any application. Logging serves several purposes like tracking a particular transaction, debugging any errors, creating dashboards, and checking the process of different application processes. MuleSoft uses the log4j2 logging standard for logging events. Some of the best practices in logging include using a transaction id, timestamp, log level and relevant message to get the information. Today we will be looking at one of the other logging ways by using a connector: JSON-Logger.

As the name suggests, the JSON logger prints the JSON format logs, which can help a lot when logging into any external log analytic tool such as ELK or Splunk. It logs the relevant information and is helpful in the customization of content and other fields. JSON logger also supports the functionality for sending data to AMQ or JMS. To use a JSON logger in your application, we need to follow the specific steps explained below:

  1. First things first, you need to clone the repository on your local system. Since JSON logger is a custom connector and not provided by MuleSoft, we need to push the logger to Anypoint exchange to use it.
  1. To push the logger to MuleSoft Anypoint exchange, get the Org Id for your Organization from the MuleSoft Anypoint platform. Go to Access Management > Business Group and Retrieve Org Id. In case you do not have access, you can use Anypoint Platform API to retrieve Org Id

Business Group

  1. Add your Anypoint username and password in settings.xml. Since we will be using mule maven plugin to deploy to exchange, make sure you add entry in settings.xml inside servers tag.

<servers>
<server>
            <id>anypoint-exchange-v2</id>
            <username>username</username>
            <password>*****</password>
        </server>
	</servers>
  1. After adding the credentials, go to the cloned directory and run the shell script with Org Id as a parameter:

  1. This script will be responsible for pushing your connector to MuleSoft Anypoint business exchange. You can see in exchange.

JSON Logger Exchange

  1. After pushing the JSON logger to exchange, we can use it in our applications using the dependency in pom.xml. You can get the dependency information from the exchange.

JSON Logger Studio

  1. The connector is handy in the application. Once you add it to the application, you can set the configuration. One can mask any particular field in payload and can disable the content depending on the business case.

JSON Logger Default Configuration

  1. You can set the message and print the payload depending on the use case. Besides, the MuleSoft developer can set the priority, and trace-point can be set for monitoring.

  1. Here is an application information snippet

JSON Logger App

  1. An Example entry by JSON logger looks like this :

{
  "correlationId" : "1ed87460-6ae1-11eb-a037-6c2b59777f19",
  "message" : "Request for Id: ++ 147",
  "tracePoint" : "AFTER_TRANSFORM",
  "priority" : "INFO",
  "elapsed" : 3415,
  "locationInfo" : {
    "lineInFile" : "18",
    "component" : "json-logger:logger",
    "fileName" : "sample-app.xml",
    "rootContainer" : "sample-appFlow"
  },
  "timestamp" : "2021-02-09T14:14:31.989Z",
  "content" : {
    "payload" : {
      "userId" : 8,
      "id" : 147,
      "title" : "eum itaque quod reprehenderit et facilis dolor autem ut",
      "completed" : true
    }
  },
  "applicationName" : "sample-elk-app",
  "applicationVersion" : "1.0",
  "environment" : "local",
  "threadName" : "[MuleRuntime].uber.07: [sample-elk-app].sample-appFlow.BLOCKING @1e0641d"
}

Recent Blogs

Salesforce Pricing Automation: Boost Efficiency And Accuracy with Apex Triggers
BlogSep 9, 2025

Salesforce Pricing Automation: Boost Efficiency And Accuracy with Apex Triggers

Introduction In order to succeed in today’s fast-paced business landscape, precision and speed define competitive advantage. For businesses, especially those managing complex product catalogs, ensuring accurate pricing on sales orders or custom lines can be a time-consuming and error-prone task. To overcome this challenge, Salesforce trigger handlers offer a powerful solution to automate the entire… Continue reading Salesforce Pricing Automation: Boost Efficiency And Accuracy with Apex Triggers

Read More
Blog
6 min read

Salesforce Pricing Automation: Boost Efficiency And Accuracy with Apex Triggers

Introduction In order to succeed in today’s fast-paced business landscape, precision and speed define competitive advantage. For businesses, especially those managing complex product catalogs, ensuring accurate pricing on sales orders or custom lines can be a time-consuming and error-prone task. To overcome this challenge, Salesforce trigger handlers offer a powerful solution to automate the entire… Continue reading Salesforce Pricing Automation: Boost Efficiency And Accuracy with Apex Triggers

Read More
Connecting MuleSoft and Azure SQL with Entra ID
BlogJul 14, 2025

Connecting MuleSoft and Azure SQL with Entra ID

Introduction Establishing a secure connection between MuleSoft and Azure SQL Database can be challenging, especially if you are using Entra ID (formerly known as Azure Active Directory) for authentication. This blog walks through a fully working configuration for connecting to Azure SQL using ActiveDirectoryServicePrincipal in Mule runtime 4.7.4 with Java 8 — addressing driver setup,… Continue reading Connecting MuleSoft and Azure SQL with Entra ID

Read More
Blog
2 min read

Connecting MuleSoft and Azure SQL with Entra ID

Introduction Establishing a secure connection between MuleSoft and Azure SQL Database can be challenging, especially if you are using Entra ID (formerly known as Azure Active Directory) for authentication. This blog walks through a fully working configuration for connecting to Azure SQL using ActiveDirectoryServicePrincipal in Mule runtime 4.7.4 with Java 8 — addressing driver setup,… Continue reading Connecting MuleSoft and Azure SQL with Entra ID

Read More
Understanding Salesforce Flow Approval Processes
BlogJun 30, 2025

Understanding Salesforce Flow Approval Processes

Introduction: Salesforce introduced Flow Approval Processes in the Spring '25 release. This is an evolved version of the classic approval process model, powered by Flow Orchestrator. The new approach brings unprecedented flexibility, enabling the creation of dynamic, multi-level, and logic-driven approval workflows that are entirely declarative. Continue reading the blog to get a deeper understanding… Continue reading Understanding Salesforce Flow Approval Processes

Read More
Blog
5 min read

Understanding Salesforce Flow Approval Processes

Introduction: Salesforce introduced Flow Approval Processes in the Spring '25 release. This is an evolved version of the classic approval process model, powered by Flow Orchestrator. The new approach brings unprecedented flexibility, enabling the creation of dynamic, multi-level, and logic-driven approval workflows that are entirely declarative. Continue reading the blog to get a deeper understanding… Continue reading Understanding Salesforce Flow Approval Processes

Read More
Capturing Real-time Record Updation Using LWC
BlogMay 14, 2025

Capturing Real-time Record Updation Using LWC

Introduction In modern CRM ecosystems, real-time Salesforce integration and seamless user experiences are no longer optional but fundamental for driving operational efficiency. Imagine your sales reps making important Opportunity changes, but the ERP remains out of sync, leading to confusion and data errors. We understood the necessity to bridge this data gap and implemented a… Continue reading Capturing Real-time Record Updation Using LWC

Read More
Blog
5 min read

Capturing Real-time Record Updation Using LWC

Introduction In modern CRM ecosystems, real-time Salesforce integration and seamless user experiences are no longer optional but fundamental for driving operational efficiency. Imagine your sales reps making important Opportunity changes, but the ERP remains out of sync, leading to confusion and data errors. We understood the necessity to bridge this data gap and implemented a… Continue reading Capturing Real-time Record Updation Using LWC

Read More