How to send Mule application logging entries to SumoLogic

Author: Shruti Puri

In this blog we will try to learn how we can send logs to SumoLogic from MuleSoft using Sumologic Appender.

What is SumoLogic?

SumoLogic is a cloud-based machine data analytics company focusing on security, operations, and BI use cases. It provides log management and analytics services that leverage machine-generated big data to deliver real-time IT insights.

Register with SumoLogic:

  • Enter a specific region and sign-up.

  • Select Start streaming data to SumoLogic. Click on Get Started.

  • Select DataType-Your custom app.

  • Set Up collection-HTTPS Source.

  • Configure Source.

  • Copy URL to use later in SumoLogicAppender. Click Next to finish configuring the wizard.

Enable Custom Logging For On MuleSoft Runtime:

  • Go to Project.
  • Open src/main/resoruces/log4j2.xml.
  • Add SumoLogic logging appender to the classpath.

Please add the following dependency in pom.xml: 


Configure log4j to load the SumoLogic package

<Configuration status=”info” name=”sumologic” packages=”com.sumologic.log4j”>

Tips: you can set status to “trace” to get log4j debug information

Add SumoLogic appender to log4j

<SumoLogicAppender name=”SumoAppender”  url=”${sys:sumo.server}”>
  <PatternLayout pattern=”%d{yyyy-MM-dd HH:mm:ss,SSS Z} [%t] %-5p %c – %m%n” />

Note: “sumo.server” is the URL provided by Sumologic to send the logging entries to. In the above example, you will need to pass the URL value to a system property with name “sumo.server”.

Configure Mule application to use the SumoLogic appender 

<AsyncRoot level=”INFO”>
  <AppenderRef ref=”FILE” />
  <AppenderRef ref=”SumoAppender” />
  • Run Application.
  • See the Console Log.

  • Go to
  • Go to the Search tab.
  • Enter _sourceCategory you mentioned during configuring the source and hit Start.

Enable Custom Logging For CloudHub Application: 

Before enabling the logging for cloudhub application, you need to Disable CloudHub logs. By default, this option is not available and you need to raise a ticket with MuleSoft for providing this option.

Once you disable cloudhub logs, MuleSoft is not responsible for the things below:

  • MuleSoft is not responsible for lost logging data due to misconfiguration of your own log4j appender.
  • MuleSoft is also not responsible for misconfigurations that result in performance degradation, running out of disk space, or other side effects.
  • When you disable the default CloudHub application logs, then only the system logs are available. For application worker logs, please check your own application’s logging system. Downloading logs is not an option in this scenario.
  • Only Asynchronous log appenders can be used, and Synchronous appenders should not be used.
  • Use asynchronous loggers and not synchronous ones is to avoid threading issues. Synchronous loggers can lock threads waiting for responses.

Below is full log4j2.xml which can be used for your application for enabling custom logging on cloudhub and http appender for SumoLogic.

<?xml version=”1.0″ encoding=”utf-8″?>
<Configuration status=”info” name=”cloudhub” packages=”,com.sumologic.log4j”>

<!–These are some of the loggers you can enable.
    There are several more you can find in the documentation.
        Besides this log4j configuration, you can also use Java VM environment variables
        to enable other logs like network ( or all) and
        Garbage Collector (-XX:+PrintGC). These will be append to the console, so you will
        see them in the mule_ee.log file. –>

        <RollingFile name=”file” fileName=”${sys:mule.home}${sys:file.separator}logs${sys:file.separator}APP_NAME.log”
            <PatternLayout pattern=”%d [%t] %-5p %c – %m%n” />
            <SizeBasedTriggeringPolicy size=”10 MB” />
            <DefaultRolloverStrategy max=”10″/>
            <PatternLayout pattern=”%d{yyyy-MM-dd HH:mm:ss,SSS Z} [%t] %-5p %c – %m%n” />
        <Log4J2CloudhubLogAppender name=”CLOUDHUB”

<PatternLayout pattern=”[%d{MM-dd HH:mm:ss}] %-5p %c{1} [%t] CUSTOM: %m%n” />
    <AsyncRoot level=”INFO”>
<AppenderRef ref=”FILE” />
<AppenderRef ref=”SumoAppender” />

<AppenderRef ref=”CLOUDHUB” />
<!– Http Logger shows wire traffic on DEBUG –>
<AsyncLogger name=”org.mule.module.http.internal.HttpMessageLogger” level=”WARN”/>

<!– JDBC Logger shows queries and parameters values on DEBUG –>
<AsyncLogger name=”com.mulesoft.mule.transport.jdbc” level=”WARN”/>
        <!– CXF is used heavily by Mule for web services –>
        <AsyncLogger name=”org.apache.cxf” level=”WARN”/>

        <!– Apache Commons tend to make a lot of noise which can clutter the log–>
        <AsyncLogger name=”org.apache” level=”WARN”/>

        <!– Reduce startup noise –>
        <AsyncLogger name=”org.springframework.beans.factory” level=”WARN”/>

        <!– Mule classes –>
        <AsyncLogger name=”org.mule” level=”INFO”/>
        <AsyncLogger name=”com.mulesoft” level=”INFO”/>

        <!– Reduce DM verbosity –>
        <AsyncLogger name=”org.jetel” level=”WARN”/>
        <AsyncLogger name=”Tracking” level=”WARN”/>


This is how you can enable SumoLogic logging for MuleSoft applications.

We use cookies on this site to enhance your user experience. For a complete overview of how we use cookies, please see our privacy policy.