<?xml version="1.0" encoding="utf-8"?>
<Configuration
  packages="com.mulesoft.ch.logging.appender,com.wywy.log4j.appender">
  <!--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 
    (-Djavax.net.debug=ssl 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. -->
  <Appenders>
    <RollingFile
      fileName="${sys:mule.home}${sys:file.separator}logs${sys:file.separator}SampleApplicationName.log"
      filePattern="${sys:mule.home}${sys:file.separator}logs${sys:file.separator}SampleApplicationName-%i.log"
      name="file">
      <PatternLayout
        pattern="%-5p %d [%t] [event: %X{correlationId}] %c: %m%n" />
      <SizeBasedTriggeringPolicy size="10 MB" />
      <DefaultRolloverStrategy max="10" />
    </RollingFile>
    <!-- Cloudhub appender -->
    <Log4J2CloudhubLogAppender
      addressProvider="com.mulesoft.ch.logging.DefaultAggregatorAddressProvider"
      appendMaxAttempts="${sys:logging.appendMaxAttempts}"
      appendRetryIntervalMs="${sys:logging.appendRetryInterval}"
      applicationContext="com.mulesoft.ch.logging.DefaultApplicationContext"
      batchMaxRecords="${sys:logging.batchMaxRecords}"
      batchSendIntervalMs="${sys:logging.batchSendInterval}"
      clientConnectTimeoutMs="${sys:logging.clientConnectTimeout}"
      clientMaxPacketSize="${sys:logging.clientMaxPacketSize}"
      clientSocketTimeoutMs="${sys:logging.clientSocketTimeout}"
      journalMaxFileSize="${sys:logging.journalMaxFileSize}"
      journalMaxWriteBatchSize="${sys:logging.journalMaxBatchSize}"
      memBufferMaxSize="${sys:logging.memBufferMaxSize}" name="CLOUDHUB"
      serverAddressPollIntervalMs="${sys:logging.serverAddressPollInterval}"
      serverHeartbeatSendIntervalMs="${sys:logging.serverHeartbeatSendIntervalMs}"
      statisticsPrintIntervalMs="${sys:logging.statisticsPrintIntervalMs}">
      <PatternLayout
        pattern="[%d{MM-dd HH:mm:ss}] %-5p %c{1} [%t] CUSTOM: %m%n" />
    </Log4J2CloudhubLogAppender>
    <Fluency name="fluency" tag="yourTag">
      <!-- all settings are optional, see defaultFluency() for default values -->
      <!-- you can add as may fields as you like (or none at all) -->
      <StaticField name="application">SampleApplicationName</StaticField>
      <StaticField name="someOtherField">some value</StaticField>
      <Server host="primary-node" port="24224" />
      <Server host="secondary-node" port="24224" />
      <FluencyConfig ackResponseMode="true"
        bufferChunkInitialSize="4194304" bufferChunkRetentionSize="16777216"
        fileBackupDir="/tmp/fluency" flushIntervalMillis="200"
        maxBufferSize="268435456" senderMaxRetryCount="12"
        waitUntilBufferFlushed="30" waitUntilFlusherTerminated="40" />
    </Fluency>
  </Appenders>
  <Loggers>
    <!-- Http Logger shows wire traffic on DEBUG. -->
    <!--AsyncLogger name="org.mule.service.http.impl.service.HttpMessageLogger" 
      level="DEBUG" / -->
    <AsyncLogger level="WARN" name="org.mule.service.http" />
    <AsyncLogger level="WARN" name="org.mule.extension.http" />
    <!-- Mule classes -->
    <AsyncLogger level="INFO" name="org.mule" />
    <AsyncLogger level="INFO" name="com.mulesoft" />
    <AsyncRoot level="INFO">
      <AppenderRef ref="file" />
      <AppenderRef ref="CLOUDHUB" />
      <AppenderRef ref="fluency" />
    </AsyncRoot>
  </Loggers>
</Configuration>