Message Logging Policy in MuleSoft

The Message Logging policy logs custom messages from incoming requests, responses from the backend, or information from other policies applied to the same API endpoint.
Steps to implement the Message Logging Policy:
- Select the Message Logging Policy from the Apply New Policy in the API Manager.

- Now specify the type of content you want to log. Fill the Parameters accordingly :
| Message | A DataWeave expression to use for extracting the message to be logged. |
| Conditional | A DataWeave Boolean expression used to specify whether a message is to be logged |
| Category | A prefix in the log message that indicates the package and class where the log is executed. If no category is set, the default value is org.mule.runtime.logging.policy-<policy id>. |
| Level | Defines the level of message to log: INFO, WARN, ERROR, or DEBUG |
| Before Calling API | Set to cause your logging policy to log messages before the API endpoint is called, taking into account the order in which this policy is applied |
| After Calling API | Set to cause your logging policy to log messages after the API endpoint is called, taking into account the order in which this policy is applied |
Suppose we want to log the payload; accordingly, we need to set the parameters as shown in the image below:

- Give the request to the API.

- Now open the Logs of the API.
Anypoint Platform -> Runtime Manager -> API -> Logs,
We can see the payload in the logs, which is similar to what we got while requesting the API.

Thanks for reading. Learn more from certified MuleSoft Experts here at Caelius Consulting Resource Centre
Recent Blogs

CPQ to Agentforce Revenue Management: Why Your Next Migration Should Start with Business Strategy, Not Configuration
Every technology platform eventually evolves. The organizations that realize the greatest value are not the ones that migrate first they are the ones that use the transition to rethink how their business operates. That is exactly where many organizations find themselves today as they plan their move from Salesforce CPQ to Agentforce Revenue Management. The… Continue reading CPQ to Agentforce Revenue Management: Why Your Next Migration Should Start with Business Strategy, Not Configuration
CPQ to Agentforce Revenue Management: Why Your Next Migration Should Start with Business Strategy, Not Configuration
Every technology platform eventually evolves. The organizations that realize the greatest value are not the ones that migrate first they are the ones that use the transition to rethink how their business operates. That is exactly where many organizations find themselves today as they plan their move from Salesforce CPQ to Agentforce Revenue Management. The… Continue reading CPQ to Agentforce Revenue Management: Why Your Next Migration Should Start with Business Strategy, Not Configuration

Integrating Salesforce with MuleSoft: A Practical Guide
Salesforce and MuleSoft integrations are often presented as straightforward connector setups but the real complexity lies in authentication design and access control. This guide walks through a clean, production-ready approach to setting up a secure integration between Salesforce and MuleSoft. Why This Matters More Than Ever With recent updates in Salesforce, basic authentication is being… Continue reading Integrating Salesforce with MuleSoft: A Practical Guide
Integrating Salesforce with MuleSoft: A Practical Guide
Salesforce and MuleSoft integrations are often presented as straightforward connector setups but the real complexity lies in authentication design and access control. This guide walks through a clean, production-ready approach to setting up a secure integration between Salesforce and MuleSoft. Why This Matters More Than Ever With recent updates in Salesforce, basic authentication is being… Continue reading Integrating Salesforce with MuleSoft: A Practical Guide

Designing for Reality: Integrating 837 Claims When X12 Meets Production
Designing 837 Claim Integration for Real-World Healthcare Systems When it comes to 837 claim integration, most architects assume the X12 specification guarantees predictability. On paper, the 837 Professional, Institutional, and Dental transactions look clean and orderly. In production? Not even close. Real-world 837 files behave differently across trading partners. Loops appear conditionally. Repeatable segments shift… Continue reading Designing for Reality: Integrating 837 Claims When X12 Meets Production
Designing for Reality: Integrating 837 Claims When X12 Meets Production
Designing 837 Claim Integration for Real-World Healthcare Systems When it comes to 837 claim integration, most architects assume the X12 specification guarantees predictability. On paper, the 837 Professional, Institutional, and Dental transactions look clean and orderly. In production? Not even close. Real-world 837 files behave differently across trading partners. Loops appear conditionally. Repeatable segments shift… Continue reading Designing for Reality: Integrating 837 Claims When X12 Meets Production

AI-Driven PDF Parsing in Salesforce
Introduction For the current digital ecosystem, data is an important aspect for decision-making. Yet, for many organizations, a significant portion of this valuable data remains locked away in unstructured formats. Organizations handle thousands of PDF documents daily — ranging from contracts and invoices to lab reports, quotations, and service agreements. Traditionally, extracting structured data from… Continue reading AI-Driven PDF Parsing in Salesforce
AI-Driven PDF Parsing in Salesforce
Introduction For the current digital ecosystem, data is an important aspect for decision-making. Yet, for many organizations, a significant portion of this valuable data remains locked away in unstructured formats. Organizations handle thousands of PDF documents daily — ranging from contracts and invoices to lab reports, quotations, and service agreements. Traditionally, extracting structured data from… Continue reading AI-Driven PDF Parsing in Salesforce