Logger Component in Mule
This Core component helps you monitor and debug your Mule application by logging important information such as error messages, status notifications, payloads, and so on. You can add a Logger anywhere in a flow, and you can configure it to log a string that you specify, the output of a DataWeave expression you write, or any combination of strings and expressions.
The configured messages are logged to the app’s log file, which is located in MULE_HOME/logs/<app-name>.log if no custom log file path is specified in the log4j2.xml file.
In Studio, the logs show in the Console.
Every app that you build in Studio comes with its own log4j2.xml file. The log contains information about any errors raised in the app (unless you have app logic to handle those errors). It also contains anything you want to explicitly log, if you build the logic in the app.
Mule automatically logs multiple messages and specific elements in your app flows to help you debug and keep track of events. You can also include the Logger component anywhere in a flow and set it up to output any message you want.
You can view an app log as follows:
If you’re running an app from the Anypoint Platform, the output from the app log is visible in Anypoint Studio’s console window.
If you’re using Mule from the command line to run an app, the app log is visible in your OS console.
You can also view the app log in this default location, unless the log file path was customized in the app’s log file (log4j2.xml):
MULE_HOME/logs/<app-name>.log
Here we are using Logger component in mule 3 in Anypoint studio 6.2
Logger component logs the incoming message.
Below is the basic flow having logger component.
HTTP Listener Configuration :
path : /testlogger
In logger component, write desired message which you want to log.Here i am giving message : Hello Himanshu
URL : http://localhost:8085/api/testlogger
method : GET
console output :
No comments:
Post a Comment