<?xml version="1.0"?>

<log4net>
  <appender name="LogFileAppender" type="log4net.Appender.RollingFileAppender">
    <param name="File" value="/var/log/IscAppConnectorHost.log"/>
    <lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
    <appendToFile value="true" />
    <rollingStyle value="Size" />
    <maxSizeRollBackups value="2" />
    <maximumFileSize value="256KB" />
    <staticLogFileName value="true" />
    <layout type="log4net.Layout.DynamicPatternLayout">
      <param name="Header" value="[Header]Local: %date{yyyy-MM-dd HH:mm:ss.fff} UTC: %utcdate{yyyy-MM-dd HH:mm:ss.fff} &#13;&#10;" />
      <param name="Footer" value="[Footer]&#13;&#10;" />
      <param name="ConversionPattern" value="%d [%t] %-5p %c %m%n"/>
    </layout>
  </appender>

  <appender name="ErrorFileAppender" type="log4net.Appender.RollingFileAppender">
    <param name="File" value="/opt/userdata/log/IscAppConnectorHostError.log"/>
    <lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
    <appendToFile value="true" />
    <rollingStyle value="Size" />
    <maxSizeRollBackups value="2" />
    <maximumFileSize value="128KB" />
    <staticLogFileName value="true" />
    <layout type="log4net.Layout.PatternLayout">
      <param name="ConversionPattern" value="%d [%t] %-5p %c %m%n"/>
    </layout>
  </appender>

  <appender name="LogFileAppender.UdpConnection" type="log4net.Appender.RollingFileAppender">
    <param name="File" value="/var/log/IscUdpConnection.log" />
    <lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
    <appendToFile value="true" />
    <rollingStyle value="Size" />
    <maxSizeRollBackups value="2" />
    <maximumFileSize value="256KB" />
    <staticLogFileName value="true" />
    <layout type="log4net.Layout.DynamicPatternLayout">
      <param name="Header" value="[Header]Local: %date{yyyy-MM-dd HH:mm:ss.fff} UTC: %utcdate{yyyy-MM-dd HH:mm:ss.fff} &#13;&#10;" />
      <param name="Footer" value="[Footer]&#13;&#10;" />
      <param name="ConversionPattern" value="%d [%t] %-5p %c %m%n" />
    </layout>
  </appender>

  <appender name="ErrorFileAppender.UdpConnection" type="log4net.Appender.RollingFileAppender">
    <param name="File" value="/opt/userdata/log/IscUdpConnectionError.log" />
    <lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
    <appendToFile value="true" />
    <rollingStyle value="Size" />
    <maxSizeRollBackups value="2" />
    <maximumFileSize value="128KB" />
    <staticLogFileName value="true" />
    <layout type="log4net.Layout.PatternLayout">
      <param name="ConversionPattern" value="%d [%t] %-5p %c %m%n" />
    </layout>
  </appender>

  <!-- Use ForwardingAppender to minimize memory leaks -->
  <appender name="ForwardingLogFileAppender" type="log4net.Appender.ForwardingAppender" >
    <threshold value="All"/>
    <appender-ref ref="LogFileAppender" />
  </appender>
  <appender name="ForwardingErrorFileAppender" type="log4net.Appender.ForwardingAppender" >
    <threshold value="Error"/>
    <appender-ref ref="ErrorFileAppender" />
  </appender>

  <appender name="ForwardingLogFileAppender.UdpConnection" type="log4net.Appender.ForwardingAppender" >
    <threshold value="All"/>
    <appender-ref ref="LogFileAppender.UdpConnection" />
  </appender>
  <appender name="ForwardingErrorFileAppender.UdpConnection" type="log4net.Appender.ForwardingAppender" >
    <threshold value="Error"/>
    <appender-ref ref="ErrorFileAppender.UdpConnection" />
  </appender>

  <root>
    <level value="INFO" />
    <appender-ref ref="ForwardingLogFileAppender" />
    <appender-ref ref="ForwardingErrorFileAppender" />
  </root>

  <logger name="IscAppConnectorHost.UdpConnection" additivity="false">
    <level value="INFO"/>
    <appender-ref ref="ForwardingLogFileAppender.UdpConnection"/>
    <appender-ref ref="ForwardingErrorFileAppender.UdpConnection"/>
  </logger>
</log4net>
