• Cryptocurrency
  • Earnings
  • Enterprise
  • About TechBooky
  • Submit Article
  • Advertise Here
  • Contact Us
TechBooky
  • African
  • AI
  • Metaverse
  • Gadgets
Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors
  • African
  • AI
  • Metaverse
  • Gadgets
Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors
TechBooky
Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors
Home Software

Accessing And Modifying Mule Message Log In MuleSoft

Contributor by Contributor
July 2, 2021
in Software
Share on FacebookShare on Twitter

In this article, we are going to discuss configuring the message logs in MuleSoft. This session incorporates the prerequisites, working of policy, the policy parameter configuration, and working with mule message logging. The Message Logging policy logs customized messages based on data from incoming requests, backend answers, or data from other policies that have been applied to the same API endpoint. You can get this course mulesoft training available online which helps you understand the mule platform. 

 

Prerequisites

To establish or administer APIs, you must hold the Anypoint Platform Organization Administrators role or have the authority to do so.

 

How does policy work?

The steps for logging a policy are as follows:

  1. To the API, a request is issued.
  2. If the following criteria are met, the message gets logged:
    • The logger defined in the log4j2.xml configuration file includes the level and category of the log indicated in the policy.
    • Either the policy’s conditional field was not set, or it was set but the condition was not matched.
  3. The response from the API is returned. The Message Logging Policy does not affect the execution or flow of any policy.
  4. The error message is recorded in the log of an application.

Policy Parameter Configuration

We can now access the program by passing this client id and secret.

Accessing/Modifying Message Logging

The Message Logging policy is used to keep track of custom messages sent between policies and flows. We can keep track of log information about a request or a response. This is useful if we need to gather request/response related logs for troubleshooting purposes without modifying the mule application’s code.

Note: The payload will be consumed by the policy if it is included in the logging message or conditional expression when utilizing non-repeatable streams.

If the streaming strategy for the below HTTP listener is changed to a Non-repeatable stream, the payload will be lost when the flow receives the request since the stream will be devoured by the policy.

We’ll start by building a mule application and connecting it to API Manager – Please see how the Mulesoft application can be connected to API Manager.

Connecting API Manager to Mulesoft application

API Manager’s auto-discovery feature allows you to manage APIs by connecting a deployed application with a platform-created API.

In this scenario, we’ll utilize Anypoint Studio to deploy the app.

Initially, AnyPoint Studio should be updated with your Anypoint Platform credentials; this is the same credential that would employ your code’s deployment to CloudHub.

We’ll need the AnyPoint platform’s credentials — if you don’t see it, ask the administrator.

Copy the Secret and Client id after clicking on the organization’s name.

In the AnyPoint Studio, update and validate the same.

 

Now we must construct the application’s API Manager setup.

Create an API Manager setup for the mule app in an API Manager, and the API name would be synchronized with assets that are exchanged.

After you’ve saved, go to Autodiscovery and look for an API ID. Make a note of it. Also, note that the status is now Unregistered.

As noticed in the previous steps, we should add an AutoDiscovery config to the Mule application – 

 

 

Only use AnyPoint Studio to deploy an application now, as this ensures that the secret and client id is delivered to Cloudhub through AnyPoint Studio.

 

Alternatively, if we would like to deploy a Mulesoft app manually or using Maven, please include the characteristics listed below in the deployment.

Click on the Tab “properties”

anypoint.platform.analytics_base_uri=https://analytics-ingest.anypoint.mulesoft.com/

anypoint.platform.client_id=2ccab1a7dcd94b69b7b1aa93c40af931

anypoint.platform.client_secret=C30fE68A87464438B534eFC47e4da0fB

anypoint.platform.base_uri=https://anypoint.mulesoft.com/

During the logs and the Mule runtime, we can observe the application indicating that API Manager has been registered successfully after it has been deployed.

In addition, we now have access to the endpoint –

If we validate the API manager once again, the status should now be Active, indicating that the application has been registered.

Now, in the API manager, add a client policy for this app.

Choose the origin of a credential.

Click Apply.

We’ll get an authentication issue if we return to the very same endpoint —

Now we’ll construct a credential for the client application to access the application – based on the Exchange access request.

 

If the SLA tier isn’t specified, the page will be redirected to the Client Application page.

Simply take note of the secret and client id.

We can now access the program by passing this secret and client id.

The API manager configuration will be Active after deployment in Cloudhub. 

We shall now put the policy into practice.

Message Logging should be selected.

Now the policy settings should be updated.

The properties are listed below.

  • Message – specify the message we would like to capture in a dataweave expression
  • Conditional – logging depending on conditions – specify in a dataweave expression
  • Category – the capture logs were categorized
  • Level– log level
  • Before calling API – Logs relating to HTTP requests
  • After calling API – Logs about HTTP requests

Let’s fill in the fields with the information we require.

We only like to capture payload if query parameters are specified – GOA is the final destination.

Click apply

Now, suppose we use SOAP UI to test this API,

In Cloudhub, we could see the logs.

Logs will not display in Cloudhub when the query param destination value is changed.

Conclusion

This article has shown you how to configure the message logging. By this, you have successfully learned how to capture the requests or responses that aids while debugging the mule application. 

 

 

References

  1. Message Logging, https://docs.mulesoft.com/api-manager/2.x/message-logging-policy
  2. Message Logging, https://mulesy.com/message-logging/

API Manager – Auto-Discovery, https://mulesy.com/api-manager-auto-discovery/

 

 

Author Bio

I am VarshaDutta Dusa, Working as a Senior Digital Marketing professional & Content writer in HKR Trainings. I Have good experience in handling technical content writing and aspire to learn new things to grow professionally. I am expert in delivering content on the market demanding technologies like  mulesoft tutorial, Dell Boomi Tutorial, Elasticsearch Course, Fortinet Course, postgresql,splunk, Success Factor, Denodo, etc. Follow me on linkedin

Related Posts:

  • google-messages-1
    Google to Launch 'Delete for Everyone' Feature on Messages
  • unnamed (24)
    Truecaller Filters Verified Business Messages
  • 454439424_1017593256482398_3651231210910483627_n
    WhatsApp Adds Multi-Language Voice Message Transcription
  • What-is-VPN-1280×800
    Best VPN Services You Can Start Using Today For Free
  • WhatsApp Will Soon Let Users Edit Sent Messages
    WhatsApp Will Soon Let Users Edit Sent Messages
  • IMessage_logo.svg
    Tips On How To Edit And Unsend An iMessage In iOS 16
  • 5f08a4e0-a383-11ef-b9ff-05c3bc6765e0
    New Feature: WhatsApp Now Lets you Store Draft Messages
  • YouTube-Guidelines-Warning-1024×576
    YouTube Is Giving Creators Violating Policies A Way…

Discover more from TechBooky

Subscribe to get the latest posts sent to your email.

Tags: applicationmulesoftMuleSoft Anypointprogramming
Contributor

Contributor

Posts by contributors. You can send in a post to be reviewed and published to info@techbooky.com

BROWSE BY CATEGORIES

Select Category

    Receive top tech news directly in your inbox

    subscription from
    Loading

    Freshly Squeezed

    • Google Changes Its “G” Logo Colours In First Major Change May 14, 2025
    • Microsoft Sacks Over 6,000 Workers, about 3% of its Total Workforce May 14, 2025
    • The AI DJ on Spotify Now Accepts Requests May 14, 2025
    • Google Unveils Material 3 Redesign for Android 16 May 14, 2025
    • PayPal Enables NFC iPhone Payments in Germany Following EU Apple Mandate May 14, 2025
    • Microsoft Reveals Rejected Start Menu Redesigns May 13, 2025

    Browse Archives

    May 2025
    MTWTFSS
     1234
    567891011
    12131415161718
    19202122232425
    262728293031 
    « Apr    

    Quick Links

    • About TechBooky
    • Advertise Here
    • Contact us
    • Submit Article
    • Privacy Policy

    Recent News

    Google Changes Its “G” Logo Colours In First Major Change

    Google Changes Its “G” Logo Colours In First Major Change

    May 14, 2025
    Microsoft Sacks Over 6,000 Workers, about 3% of its Total Workforce

    Microsoft Sacks Over 6,000 Workers, about 3% of its Total Workforce

    May 14, 2025
    The AI DJ on Spotify Now Accepts Requests

    The AI DJ on Spotify Now Accepts Requests

    May 14, 2025
    Google Unveils Material 3 Redesign for Android 16

    Google Unveils Material 3 Redesign for Android 16

    May 14, 2025
    PayPal Enables NFC iPhone Payments in Germany Following EU Apple Mandate

    PayPal Enables NFC iPhone Payments in Germany Following EU Apple Mandate

    May 14, 2025
    Microsoft Reveals Rejected Start Menu Redesigns

    Microsoft Reveals Rejected Start Menu Redesigns

    May 13, 2025
    • Login

    © 2021 Design By Tech Booky Elite

    Generic selectors
    Exact matches only
    Search in title
    Search in content
    Post Type Selectors
    • African
    • Artificial Intelligence
    • Gadgets
    • Metaverse
    • Tips
    • About TechBooky
    • Advertise Here
    • Submit Article
    • Contact us

    © 2021 Design By Tech Booky Elite

    Discover more from TechBooky

    Subscribe now to keep reading and get access to the full archive.

    Continue reading

    We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.Ok