Contact Us 1-800-596-4880

Logging

This page refers to deprecated logging functionality. Please see [Logger Component Reference] for current logging functionality, including Studio Support.

The less high-tech and most popular of all debugging techniques is the usage of log statements to follow the evolution of an application’s state. In Mule, the state you’re interested in resides in the messages that flowing through you configuration and, possibly, custom code.

If you’re running your Mule configuration from Eclipse, the log outputs will be visible right in Eclipse console window. If you’re running Mule from command line, the logs will then be visible in your OS console.

Mule’s standalone logging configuration is stored in <Mule Installation Directory>/conf/log4j.properties: edit this file if you need to change verbosity of the log output.

the log component is quick and easy way to log the payload of an in-flight message. Add it anywhere in a message flow you want to probe your message:

<flow name="FlowWithLoggers">
  <http:inbound-endpoint address="http://localhost:8383/flowlog" />
  <log-component />
  <base64-encoder-transformer/>
  <log-component />
  <vm:outbound-endpoint path="next.in.line" />
</flow>

If you need more details about the message, a simple scripted logging component like the following can come handy:

<scripting:script name="Logger" engine="groovy">
  <scripting:text>log.info(message); log.info(payload); message</scripting:text>
</scripting:script>

You can refer to it from anywhere your flow:

<flow name="FlowWithLoggers">
  <http:inbound-endpoint address="http://localhost:8383/flowlog" />
  <scripting:component script-ref="Logger" />
  <base64-encoder-transformer/>
  <scripting:component script-ref="Logger" />
  <vm:outbound-endpoint path="next.in.line" />
</flow>