<?xml version="1.0"?>
<configuration>
  <configSections>
   <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net"/>
  </configSections>

  <startup useLegacyV2RuntimeActivationPolicy="true">
    <!--顺序决定优先级. -->
    <!--如果强制在 CLR 2.0 下运行，必须设置 supportedRuntime version="v2.0.50727"，如果设置 v2.0 无效。-->    
    <!--开发时, 优先使用 2.0.   发布的时候, 优先使用4.0, 因为安装了2.0不移动有3.5sp1, 但安装了4.0肯定可以用.-->
    
    <!-- !!! 注意, 必须加上 sku=".NETFramework,Version=v4.0" 以防止使用了4.0 clint profile -->
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>    
    <supportedRuntime version="v2.0.50727"/>    
  </startup>

  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <probing privatePath="bin;bin2\subbin;bin3"/>
    </assemblyBinding>
  </runtime>
  
  <appSettings>
    <add key="changeMinWorkerThreads" value="true"></add>
    <add key="minWorkerThreads" value="100"></add>
    <add key="minIoThreads" value="2"></add>    
  </appSettings>
  
  <log4net>
    <!-- Define some output appenders -->
    <appender name="traceAppender_WithFilter" type="AlanThinker.MyLog4net.MyTraceAppender,AlanThinker.MyLog4net">
      <ImmediateFlush value="true"/>
      <layout type="AlanThinker.MyLog4net.MyPatternLayout,AlanThinker.MyLog4net">
        <conversionPattern value="%date [%3myThreadId] %-5level %logger - %message%newline"/>
        <!--<conversionPattern value="%date [%3myThreadId] %-5level %myShortLogger - %message%newline" />-->
      </layout>
      
      <!-- filter 可以有多个 -->
      <!--<filter type="log4net.Filter.LoggerMatchFilter">
        <LoggerToMatch value="AlanThinker.Game.Chess.Connector"/>
        <AcceptOnMatch value="false"/>
      </filter>-->
      <!--<filter type="log4net.Filter.LoggerMatchFilter">
        <LoggerToMatch value="AlanThinker.Game.Chess.Engines"/>
        <AcceptOnMatch value="false"/>
      </filter>-->
      
      
    </appender>
    <appender name="coloredConsoleAppender" type="log4net.Appender.ColoredConsoleAppender">
      <mapping>
        <level value="info"/>
        <foreColor value="White"/>
        <!--<backColor value="Red, HighIntensity" />-->
      </mapping>
      <mapping>
        <level value="ERROR"/>
        <foreColor value="Green"/>
      </mapping>
      <layout type="AlanThinker.MyLog4net.MyPatternLayout,AlanThinker.MyLog4net">
        <conversionPattern value="%date [%3myThreadId] %-5level %logger - %message%newline"/>
        <!--<conversionPattern value="%date [%3myThreadId] %-5level %myShortLogger - %message%newline" />-->
      </layout>
    </appender>
    <appender name="udpAppender" type="log4net.Appender.UdpAppender,log4net">
      <RemoteAddress value="127.0.0.2"/>
      <RemotePort value="7071"/>
      <LocalPort value="11222"/>
      <encoding value="utf-8"></encoding>
      <layout type="AlanThinker.MyLog4net.MyPatternLayout,AlanThinker.MyLog4net">
        <conversionPattern value="%date [%3myThreadId] %-5level %logger - %message%newline"/>
        <!--<conversionPattern value="%date [%3myThreadId] %-5level %myShortLogger - %message%newline" />-->
      </layout>
    </appender>
    <appender name="rollingFileAll" type="log4net.Appender.RollingFileAppender,log4net">
      <File value="Chess.All.txt"/>
      <AppendToFile value="true"/>
      <RollingStyle value="Date"/>
      <DatePattern value="yyyy.MM.dd"/>
      <StaticLogFileName value="true"/>
      <layout type="AlanThinker.MyLog4net.MyPatternLayout,AlanThinker.MyLog4net">
        <conversionPattern value="%date [%3myThreadId] %-5level %logger - %message%newline"/>
        <!--<conversionPattern value="%date [%3myThreadId] %-5level %myShortLogger - %message%newline" />-->
      </layout>
    </appender>
    <appender name="rollingFileChessError" type="log4net.Appender.RollingFileAppender,log4net">
      <File value="Chess.App.txt"/>
      <AppendToFile value="true"/>
      <RollingStyle value="Date"/>
      <DatePattern value="yyyy.MM.dd"/>
      <StaticLogFileName value="true"/>
      <layout type="AlanThinker.MyLog4net.MyPatternLayout,AlanThinker.MyLog4net">
        <conversionPattern value="%date [%3myThreadId] %-5level %logger - %message%newline"/>
        <!--<conversionPattern value="%date [%3myThreadId] %-5level %myShortLogger - %message%newline" />-->
      </layout>
      <filter type="log4net.Filter.LevelRangeFilter">
        <!--Only allowed value between LevelMin and LevelMax.-->
        <LevelMin value="error"/>
        <!--OFF is max value() -->
        <!--<LevelMax value="off" />-->
      </filter>
    </appender>
    
    <!-- Setup the root category, add the appenders and set the default priority -->
    <root>
      <priority value="ERROR"/>    
	  <appender-ref ref="rollingFileAll"/>
	  <appender-ref ref="rollingFileChessError"/>
    </root>

    <logger name="AlanThinker.Game.Chess.Engines.Engine.Info">
      <priority value="ERROR"/>
    </logger>
    
    <logger name="AlanThinker.Game.Chess.Engines">
      <priority value="ERROR"/>
    </logger>

    

    <logger name="AlanThinker.Game.Chess.Connector">
      <!--如果级别达到Debug, 则会记录大量图片, 可能会影响性能, 不记录图片时， 请使用 Info -->
      <priority value="ERROR"/>
    </logger>

    <logger name="AlanThinker.Game.Chess.Connector.ConnectManger.LogForClick">
      <!--如果级别达到Debug, 则会记录大量图片, 可能会影响性能, 不记录图片时， 请使用 Info -->
      <priority value="ERROR"/>
    </logger>    

    <logger name="AlanThinker.Game.Chess.Connector.ImageProcessor">
      <!--如果级别达到Debug, 则会记录大量图片, 可能会影响性能, 不记录图片时， 请使用 Info -->
      <priority value="ERROR"/>
    </logger>

  </log4net>
  
</configuration>
