• ibatis + log4net 配置注意事项


    一 在web.config或app.config中配置

       

    <configuration>

      <configSections>

    <sectionGroup name="iBATIS">
          <section name="logging" type="IBatisNet.Common.Logging.ConfigurationSectionHandler, IBatisNet.Common"/>
        </sectionGroup>
        <!--iBATIS日志配置直接放在当前文件-->
        <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />

    </configSections>
      <appSettings>

     <!--iBATIS日志配置-->
      <iBATIS>
        <logging>
          <logFactoryAdapter type="IBatisNet.Common.Logging.Impl.Log4NetLoggerFA, IBatisNet.Common.Logging.Log4Net">
            <!--不能修改为file 或 file-watch,否则ibatis sql将无法抓取-->
            <arg key="configType" value="inline"/>
          </logFactoryAdapter>
        </logging>
      </iBATIS>

    <log4net>
        <!--不能放到单独的log4net.config中,否则ibatis sql将无法抓取-->
        <root>
          <!--OFF > FATAL > ERROR > WARN > INFO > DEBUG > ALL-->
          <level value ="ERROR" />
          <appender-ref ref="LogALL" />
        </root>
        <appender name="LogALL" type="log4net.Appender.RollingFileAppender" >
          <file value="Log\" />
          <appendToFile value="true" />
          <datePattern value="yyyy-MM-dd.LOG" />
          <maxSizeRollBackups value="10" />
          <rollingStyle value="Date" />
          <maximumFileSize value="1MB" />
          <staticLogFileName value="false" />
          <layout type="log4net.Layout.PatternLayout">
            <param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss} %p %u %c %l %m %n" />
          </layout>
        </appender>
        <logger name="IBatisNet.DataMapper.Commands.DefaultPreparedCommand">
          <level value="DEBUG" />
        </logger>
        <logger name="IBatisNet.DataMapper.Configuration.Cache.CacheModel">
          <level value="DEBUG" />
        </logger>
        <logger name="IBatisNet.DataMapper.LazyLoadList">
          <level value="DEBUG" />
        </logger>
        <logger name="IBatisNet.DataMapper.SqlMapSession">
          <level value="DEBUG" />
        </logger>
        <logger name="IBatisNet.Common.Transaction.TransactionScope">
          <level value="DEBUG" />
        </logger>
        <logger name="IBatisNet.DataAccess.DaoSession">
          <level value="DEBUG" />
        </logger>
        <logger name="IBatisNet.DataAccess.Configuration.DaoProxy">
          <level value="DEBUG" />
        </logger>
        <logger name="IBatisNet.DataMapper.Configuration.Statements.PreparedStatementFactory">
          <level value="DEBUG" />
        </logger>
        <logger name="IBatisNet.DataMapper.Commands.IPreparedCommand">
          <level value="DEBUG" />
        </logger>
      </log4net>
      <!--iBATIS日志配置-->
    </configuration>

  • 相关阅读:
    python2和python3的区别
    星球大战
    [USACO]高低卡(金)High Card Low Card (Gold)
    学习笔记
    叶子的染色
    大问题
    ...
    考试前...
    [HAOI2010]计数
    [POI2006]OKR-Periods of Words
  • 原文地址:https://www.cnblogs.com/eugenewu0808/p/3936428.html
Copyright © 2020-2023  润新知