asp.net MVC日志插件Log4Net学习笔记二:保存日志到sqlserver的配置

1.写到sqlserver的配置:

asp.net MVC日志插件Log4Net学习笔记二:保存日志到sqlserver的配置
<!--保存到SQLSERVER数据库日志-->
  <log4net>
    <appender name="AdoNetAppender" type="log4net.Appender.AdoNetAppender">
      <!--<bufferSize value="10" />-->
      <connectionType value="System.Data.SqlClient.SqlConnection, System.Data, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
      <connectionString value="Server=localhost;UID=sa;PWD=8086;DataBase=daohang360;Max Pool Size=1000"/>
      <commandText value="INSERT INTO Log VALUES ([Date],[Thread],[Level],[Logger],[Message],[Exception]) (@log_date, @thread, @log_level, @logger, @message, @exception)" />
      <parameter>
        <parameterName value="@log_date" />
        <dbType value="DateTime" />
        <layout type="log4net.Layout.RawTimeStampLayout" />
      </parameter>
      <parameter>
        <parameterName value="@thread" />
        <dbType value="String" />
        <size value="255" />
        <layout type="log4net.Layout.PatternLayout">
          <conversionPattern value="%thread" />
        </layout>
      </parameter>
      <parameter>
        <parameterName value="@log_level" />
        <dbType value="String" />
        <size value="50" />
        <layout type="log4net.Layout.PatternLayout">
          <conversionPattern value="%level" />
        </layout>
      </parameter>
      <parameter>
        <parameterName value="@logger" />
        <dbType value="String" />
        <size value="255" />
        <layout type="log4net.Layout.PatternLayout">
          <conversionPattern value="%logger" />
        </layout>
      </parameter>
      <parameter>
        <parameterName value="@message" />
        <dbType value="String" />
        <size value="4000" />
        <layout type="log4net.Layout.PatternLayout">
          <conversionPattern value="%message" />
        </layout>
      </parameter>
      <parameter>
        <parameterName value="@exception" />
        <dbType value="String" />
        <size value="2000" />
        <layout type="log4net.Layout.ExceptionLayout" />
      </parameter>
    </appender>
    <root>
      <!-- Set this to "ERROR" before release -->
      <!--Highest: OFF->FATAL->RROR->WARN->INFO->DEBUG->ALL :Lowest -->
      <level value="ALL" />
      <appender-ref ref="AdoNetAppender" />
      <!-- <appender-ref ref="SmtpAppender" /> -->
      <!--<appender-ref ref="FileAppender" /> -->
    </root>
  </log4net>
asp.net MVC日志插件Log4Net学习笔记二:保存日志到sqlserver的配置

asp.net MVC日志插件Log4Net学习笔记二:保存日志到sqlserver的配置

上一篇:sqlmap映射继承机制及映射字段顺序与SQL查询字段顺序无关


下一篇:Java 序列化Serializable详解