In Anypoint Studio, the log4j2.xml
file is located in the src/main/resources
directory.
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="INFO" name="cloudhub" packages="com.splunk.logging,org.apache.logging.log4j">
<Appenders>
<Console name="CONSOLE" target="SYSTEM_OUT">
<PatternLayout pattern="[%d{MM-dd HH:mm:ss}] %-5p %c{1} [%t]: %m%n"/>
</Console>
<SplunkHttp name="SPLUNK"
source="${env:APP_NAME}"
host="${env:POD_NAME}"
sourceType="mule-app"
url="${sys:splunk.host}"
token="${sys:splunk.token}"
index="main">
<PatternLayout pattern="[%d{MM-dd HH:mm:ss}] %-5p %c{1} [%t]: %m%n" />
</SplunkHttp>
</Appenders>
<Loggers>
<AsyncRoot level="INFO">
<AppenderRef ref="CONSOLE"/>
<AppenderRef ref="SPLUNK"/>
</AsyncRoot>
</Loggers>
</Configuration>
Deploying an app to CloudHub 2.0 configures AnypointMonitoringFileAppender automatically,
so you don’t need to configure it in log4j2.xml .
|