zoukankan      html  css  js  c++  java
  • Log4NET SQL配置

    <?xml version="1.0" encoding="utf-8" ?>
    <log4net>
      <logger name="SqlLogger">
        <level value="ERROR" />
        <appender-ref ref="ADONetAppender_SqlServer" />
      </logger>
      <appender name="ADONetAppender_SqlServer" type="log4net.Appender.AdoNetAppender">
        <bufferSize value="1" />
        <connectionType value="System.Data.SqlClient.SqlConnection, System.Data, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
        <connectionString value="data source=服务器;initial catalog=数据库;integrated security=false;persist security info=True;User ID=用户名;Password=密码" />
        <commandText value="insert into whptLog(LogDate,LogThread,LogLevel,LogLogger,LogMessage,LogErrorClass,LogLine) values(@date,@thread,@level,@logger,@message,@class,@line)" />
        <parameter>
          <parameterName value="@date" />
          <dbType value="DateTime" />
          <layout type="log4net.Layout.RawTimeStampLayout" />
        </parameter>
        <parameter>
          <parameterName value="@thread" />
          <dbType value="String" />
          <size value="20" />
          <layout type="log4net.Layout.PatternLayout">
            <conversionPattern value="%t" />
          </layout>
        </parameter>
        <parameter>
          <parameterName value="@level" />
          <dbType value="String" />
          <size value="10" />
          <layout type="log4net.Layout.PatternLayout">
            <conversionPattern value="%-10p" />
          </layout>
        </parameter>
        <parameter>
          <parameterName value="@logger" />
          <dbType value="String" />
          <size value="20" />
          <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="%exception" />
          </layout>
        </parameter>
        <parameter>
          <parameterName value="@class" />
          <dbType value="String" />
          <size value="100" />
          <layout type="log4net.Layout.PatternLayout">
            <conversionPattern value="%c" />
          </layout>
        </parameter>
        <parameter>
          <parameterName value="@line" />
          <dbType value="String" />
          <size value="4000" />
          <layout type="log4net.Layout.PatternLayout">
            <conversionPattern value="文件:%F----->行:%L" />
          </layout>
        </parameter>
      </appender>
    </log4net>
  • 相关阅读:
    多线程中的wait与sleep到底谁释放了锁?
    Java并发编程:volatile关键字解析
    Spring的bean为什么是单例的?
    Java学习之反射
    Http && Https(绕过证书) 请求工具类 (Java)
    Java工具-检验ftp服务器的指定文件是否存在
    文件读取FileUtil工具类 亲测可用
    MyBatis 遇到的报错
    Mac终端 mysql Operation not permitted错误解决方案
    Kubernetes---修改证书可用年限
  • 原文地址:https://www.cnblogs.com/haoqi/p/3388193.html
Copyright © 2011-2022 走看看