How To Add Parse Template In Mulesoft Any Point Studio Dzone
Author: Neelam Deshmukh
ane. Overview
Logging is useful for monitoring and troubleshooting your Mule applications and the Mule server — whether that's recording errors raised by the application or specific details, such as status notifications, custom metadata, and payloads.
The out-of-the-box logger component offered by Mule runtime is really easy to utilize and understand, just it hardly enforces any standards and does not facilitate the creation of structured logs.
In this blog, we will learn an approach to keep the logging experience as elementary as writing a one text entry, while having a full fledgeJSON structure as the output using JSON logger,its features and how to utilize it.
2. JSON logger module
The JSON Logger connector looks like below in Anypoint Exchange.
You can download it from commutation by using MuleSoft premium or guest account in Anypoint Studio and add it in Mule palette.
3. Characteristic of JSON Logger
Below are two important features of Json Logger:
- Log Location Info
Location object gives you everything you want to know nigh where you lot are in your application. This is what information technology looks like as beneath:
As you tin can see, critical troubleshooting data such as the name of the menstruation (rootContainer), name of the xml configuration file (fileName), and the exact line number where the logger is located (lineInFile) can now be part of the log metadata and configured through the global config element:
- Disabled Fields
JSON logger provides two very distinct fields out-of-the-box:
- message:Field meant for meaningful non-sensitive functional messages such equally "Asking received from Client with ID: 1234"
- content:Field meant for raw data typically useful during development and test phases (east.one thousand. payload, attributes, vars, etc.)
If somehow we are able to point our evolution team in the correct management and accept them log valuable non-sensitive data in themessagefield, and whatever raw troubleshooting data into thecontentfield, then we can leverage the "disabled fields" feature to filter certain log fields from being printed (due east.g. content):
The above instance volition effectively tell the JSON logger that it needs to skip any field divers here (you can add together many comma-separated fields, eastward.g. content, message, etc.). Taking this a pace further, we could assign an environment variable (e.thou. ${logger.disabled.fields}), which in lower environments could be null, merely and then on stage and production could be set up to "content."
4. How to Use
Below are steps for usage:
Footstep 1: As yous can run into in the paradigm in a higher place , once installed, the JSON logger will bear witness in the Studio Palette as whatsoever standard component; it tin also be dragged-and-dropped into the canvas.
Step 2: Configure Json Logger
In this scenario, we are logging the electric current #[payload] and using theGet-goTrace Point.
Trace Points aims to facilitate the standardization of certain "checkpoints" throughout the flow execution, which, in plough, enable more intelligent dashboards and reporting based on this data.
The current JSON logger ships with the following Trace Points:
- Starting time (Default)
- BEFORE_REQUEST
- AFTER_REQUEST
- BEFORE_TRANSFORM
- AFTER_TRANSFORM
- END
- EXCEPTION
- Menstruation
In the connector, you volition see the post-obit configuration by default:
- The awarding name is equivalent to your awarding name
- The application version is equivalent to your application version
- The environment is equivalent to your application environs
5. Conclusion
In this tutorial, we looked at what JSON Logger is,some of its key features and how to use it.
6. References
- https://blogs.mulesoft.com/dev/anypoint-platform-dev/json-logging-mule-4/
- https://blogs.mulesoft.com/dev/mule-dev/logging-in-mule-using-json-logger-module/
- https://docs.mulesoft.com/mule-runtime/four.2/logging-and-debugging
How To Add Parse Template In Mulesoft Any Point Studio Dzone,
Source: https://apisero.com/json-logger-in-mule-4/
Posted by: mcdanielalsorombicks.blogspot.com

0 Response to "How To Add Parse Template In Mulesoft Any Point Studio Dzone"
Post a Comment