<?xml version="1.0"?>

<log4net>
  <!-- Short legend:
        LFA = LogFileAppender 
        EFA = ErrorFileAppender 
        FLFA = ForwardingLogFileAppender 
        FEFA = ForwardingErrorFileAppender 
  -->
  <!-- EChargeIIApp default configuration -->
  <appender name="LFA.EChargeIIApp" type="log4net.Appender.RollingFileAppender">
    <param name="File" value="/var/log/EChargeApp.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="EFA.EChargeIIApp" type="log4net.Appender.RollingFileAppender">
    <param name="File" value="/opt/userdata/log/EChargeAppError.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="FLFA.EChargeIIApp" type="log4net.Appender.ForwardingAppender" >
    <threshold value="All"/>
    <appender-ref ref="LFA.EChargeIIApp" />
  </appender>
  <appender name="FEFA.EChargeIIApp" type="log4net.Appender.ForwardingAppender" >
    <threshold value="Error"/>
    <appender-ref ref="EFA.EChargeIIApp" />
  </appender>

  <logger name="EChargeIIApp" additivity="false">
    <level value="INFO"/>
    <appender-ref ref="FLFA.EChargeIIApp"/>
    <appender-ref ref="FEFA.EChargeIIApp"/>
  </logger>

  <!-- EChargeIIApp.Tools.ValueLogger configuration -->
  <appender name="LFA.EChargeIIApp.Tools.ValueLogger" type="log4net.Appender.RollingFileAppender">
    <param name="File" value="/var/log/EChargeAppValueLogger.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="EFA.EChargeIIApp.Tools.ValueLogger" type="log4net.Appender.RollingFileAppender">
    <param name="File" value="/opt/userdata/log/EChargeAppValueLoggerError.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="FLFA.EChargeIIApp.Tools.ValueLogger" type="log4net.Appender.ForwardingAppender" >
    <threshold value="All"/>
    <appender-ref ref="LFA.EChargeIIApp.Tools.ValueLogger" />
  </appender>
  <appender name="FEFA.EChargeIIApp.Tools.ValueLogger" type="log4net.Appender.ForwardingAppender" >
    <threshold value="Error"/>
    <appender-ref ref="EFA.EChargeIIApp.Tools.ValueLogger" />
  </appender>

  <logger name="EChargeIIApp.Tools.ValueLogger" additivity="false">
    <level value="INFO"/>
    <appender-ref ref="FLFA.EChargeIIApp.Tools.ValueLogger"/>
    <appender-ref ref="FEFA.EChargeIIApp.Tools.ValueLogger"/>
  </logger>

  <!-- HardwareComponents configuration -->
  <appender name="LFA.HardwareComponents" type="log4net.Appender.RollingFileAppender">
    <param name="File" value="/var/log/EChargeAppHardwareComponents.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="EFA.HardwareComponents" type="log4net.Appender.RollingFileAppender">
    <param name="File" value="/opt/userdata/log/EChargeAppHardwareComponentsError.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="FLFA.HardwareComponents" type="log4net.Appender.ForwardingAppender" >
    <threshold value="All"/>
    <appender-ref ref="LFA.HardwareComponents" />
  </appender>
  <appender name="FEFA.HardwareComponents" type="log4net.Appender.ForwardingAppender" >
    <threshold value="Error"/>
    <appender-ref ref="EFA.HardwareComponents" />
  </appender>

  <logger name="HardwareComponents" additivity="false">
    <level value="INFO"/>
    <appender-ref ref="FLFA.HardwareComponents"/>
    <appender-ref ref="FEFA.HardwareComponents"/>
  </logger>

  <logger name="HardwareInverter" additivity="false">
    <level value="ALL"/>
    <appender-ref ref="FLFA.HardwareComponents"/>
    <appender-ref ref="FEFA.HardwareComponents"/>
  </logger>

  <!-- Load management configuration -->
  <appender name="LFA.DLM" type="log4net.Appender.RollingFileAppender">
    <param name="File" value="/var/log/EChargeAppLoadManagement.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="EFA.DLM" type="log4net.Appender.RollingFileAppender">
    <param name="File" value="/opt/userdata/log/EChargeAppLoadManagementError.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="FLFA.DLM" type="log4net.Appender.ForwardingAppender" >
    <threshold value="All"/>
    <appender-ref ref="LFA.DLM" />
  </appender>
  <appender name="FEFA.DLM" type="log4net.Appender.ForwardingAppender" >
    <threshold value="Error"/>
    <appender-ref ref="EFA.DLM" />
  </appender>

  <logger name="LoadManagement" additivity="false">
    <level value="INFO"/>
    <appender-ref ref="FLFA.DLM"/>
    <appender-ref ref="FEFA.DLM"/>
  </logger>
  <logger name="LoadManagementPv" additivity="false">
    <level value="INFO"/>
    <appender-ref ref="FLFA.DLM"/>
    <appender-ref ref="FEFA.DLM"/>
  </logger>
  <logger name="LoadManagerFactory" additivity="false">
    <level value="INFO"/>
    <appender-ref ref="FLFA.DLM"/>
    <appender-ref ref="FEFA.DLM"/>
  </logger>

  <!-- ModbusCommunicationManager configuration -->
  <appender name="LFA.ModbusCommunicationManager" type="log4net.Appender.RollingFileAppender">
    <param name="File" value="/var/log/EChargeAppModbusCommunicationManager.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="EFA.ModbusCommunicationManager" type="log4net.Appender.RollingFileAppender">
    <param name="File" value="/opt/userdata/log/EChargeAppModbusCommunicationManagerError.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="FLFA.ModbusCommunicationManager" type="log4net.Appender.ForwardingAppender" >
    <threshold value="All"/>
    <appender-ref ref="LFA.ModbusCommunicationManager" />
  </appender>
  <appender name="FEFA.ModbusCommunicationManager" type="log4net.Appender.ForwardingAppender" >
    <threshold value="Error"/>
    <appender-ref ref="EFA.ModbusCommunicationManager" />
  </appender>

  <logger name="ModbusCommunicationManager" additivity="false">
    <level value="INFO"/>
    <appender-ref ref="FLFA.ModbusCommunicationManager"/>
    <appender-ref ref="FEFA.ModbusCommunicationManager"/>
  </logger>

  <!-- Assemblies for default file appenders configuration -->
  <!-- ErrorHandler configuration -->
  <logger name="ErrorHandler" additivity="false">
    <level value="INFO"/>
    <appender-ref ref="FLFA.EChargeIIApp"/>
    <appender-ref ref="FEFA.EChargeIIApp"/>
  </logger>
  <!-- Schedulers configuration -->
  <logger name="Schedulers" additivity="false">
    <level value="INFO"/>
    <appender-ref ref="FLFA.EChargeIIApp"/>
    <appender-ref ref="FEFA.EChargeIIApp"/>
  </logger>
  <!-- UnitValues configuration -->
  <logger name="UnitValues" additivity="false">
    <level value="INFO"/>
    <appender-ref ref="FLFA.EChargeIIApp"/>
    <appender-ref ref="FEFA.EChargeIIApp"/>
  </logger>
  <!-- ModbusMaster configuration -->
  <logger name="ModbusMaster" additivity="false">
    <level value="INFO"/>
    <appender-ref ref="FLFA.EChargeIIApp"/>
    <appender-ref ref="FEFA.EChargeIIApp"/>
  </logger>
</log4net>
