<?xml version="1.0" encoding="utf-8" ?>
<log4net>
  <!-- 控制台输出（调试用） -->
  <appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender">
    <layout type="log4net.Layout.PatternLayout">
      <conversionPattern value="%date [%thread] %-5level %logger - %message%newline" />
    </layout>
  </appender>

  <!-- 运行日志（INFO及以上，按日期滚动，保留30天） -->
  <appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender">
    <file value="logs\collector.log" />
    <appendToFile value="true" />
    <rollingStyle value="Date" />
    <datePattern value="yyyy-MM-dd" />
    <maxSizeRollBackups value="30" />
    <staticLogFileName value="true" />
    <lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
    <layout type="log4net.Layout.PatternLayout">
      <conversionPattern value="%date [%thread] %-5level %logger - %message%newline" />
    </layout>
  </appender>

  <!-- 错误日志（仅ERROR和FATAL，按日期滚动，保留30天） -->
  <appender name="ErrorFileAppender" type="log4net.Appender.RollingFileAppender">
    <file value="logs\collector_error.log" />
    <appendToFile value="true" />
    <rollingStyle value="Date" />
    <datePattern value="yyyy-MM-dd" />
    <maxSizeRollBackups value="30" />
    <staticLogFileName value="true" />
    <lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
    <threshold value="ERROR" />
    <layout type="log4net.Layout.PatternLayout">
      <conversionPattern value="%date [%thread] %-5level %logger - %message%newline" />
    </layout>
  </appender>

  <root>
    <level value="INFO" />
    <appender-ref ref="ConsoleAppender" />
    <appender-ref ref="RollingFileAppender" />
    <appender-ref ref="ErrorFileAppender" />
  </root>
</log4net>
