log4Net与IBatisNet配合的配置文件

<?xml version="1.0" encoding="utf-8" ?>

<configuration>
  <!-- This section contains the log4net configuration settings -->
  <configSections>
   
    <sectionGroup name="iBATIS">
      <section name="logging" type="IBatisNet.Common.Logging.ConfigurationSectionHandler, IBatisNet.Common" />
    </sectionGroup>
   
    <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/>
   
  </configSections>

  <iBATIS>
    <logging>

      <logFactoryAdapter type="IBatisNet.Common.Logging.Impl.ConsoleOutLoggerFA, IBatisNet.Common">
        <arg key="showLogName" value="true" />
        <arg key="showDataTime" value="true" />
        <arg key="level" value="INFO" />
        <arg key="dateTimeFormat" value="yyyy/MM/dd HH:mm:ss:SSS" />
      </logFactoryAdapter>

    </logging>
  </iBATIS>
 
  <log4net>
    <root>           
      <level value="ALL" />                
      <appender-ref ref="RollingLogDateFileAppender" />
      <appender-ref ref="ConsoleAppender" />
    </root>
   
    <appender name="LogFileAppender" type="log4net.Appender.FileAppender" >
      <param name="File" value="log-file.txt" />
      <param name="AppendToFile" value="true" />
      <layout type="log4net.Layout.PatternLayout">
        <param name="Header" value="[Header]\r\n"/>
        <param name="Footer" value="[Footer]\r\n"/>
        <param name="ConversionPattern" value="%d  %c %m%n" />
        <!--
            value="%d [%t] %-5p %c [%x]  - %m%n"
            -->
          </layout>     
          <filter type="log4net.Filter.LevelRangeFilter">
            <param name="LevelMin" value="INFO" />
            <param name="LevelMax" value="FATAL" />
          </filter>
        </appender>

    <appender name="RollingLogDateFileAppender" type="log4net.Appender.RollingFileAppender">
      <param name="File" value="_LogFile\\"/>
      <param name="AppendToFile" value="true"/>
      <param name="datePattern" value="yyyyMMdd.LOG"/>
      <param name="MaxSizeRollBackups" value="40"/>
      <param name="MaximumFileSize" value="5MB"/>
      <param name="RollingStyle" value="Date"/>
      <param name="StaticLogFileName" value="false"/>
      <layout type="log4net.Layout.PatternLayout">
        <param name="ConversionPattern" value="%d [%t] %-5p %c [%x] - %m%n"/>
      </layout>
      <filter type="log4net.Filter.LevelRangeFilter">
        <param name="LevelMin" value="INFO" />
        <param name="LevelMax" value="FATAL" />
      </filter>
    </appender>
   
    <appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender" >
      <layout type="log4net.Layout.PatternLayout">
        <param name="ConversionPattern" value="%d  - %m%n" />
      </layout>
    </appender>   
     
    <logger name="IBatisNet.DataMapper.Configuration.Cache.CacheModel">
      <level value="OFF" />
    </logger>
    <logger name="IBatisNet.DataMapper.Configuration.Statements.PreparedStatementFactory">
      <level value="OFF" />
    </logger>
    <logger name="IBatisNet.DataMapper.Commands.IPreparedCommand">
      <level value="OFF" />
    </logger>
    <logger name="IBatisNet.DataMapper.LazyLoadInterceptor">
      <level value="OFF" />
    </logger>
    <logger name="IBatisNet.DataMapper.LazyLoadProxyFactory">
      <level value="OFF" />
    </logger>
    <logger name="IBatisNet.DataAccess.DaoSession">
      <level value="OFF" />
    </logger>
    <logger name="IBatisNet.DataMapper.SqlMapSession">
      <level value="OFF" />
    </logger>
    <logger name="IBatisNet.Common.Transaction.TransactionScope">
      <level value="OFF" />
    </logger>
    <logger name="IBatisNet.DataAccess.Configuration.DaoProxy">
      <level value="OFF" />
    </logger>
    <logger name="IBatisNet.DataMapper.Commands.DefaultPreparedCommand">
      <level value="OFF" />
    </logger>
  </log4net>
</configuration>

你可能感兴趣的:(ibatis)