2 wangganggang90 wangganggang90 于 2014.07.10 11:21 提问

求大神帮忙审查一下log4net的数据库配置


<!--BufferSize为缓冲区大小,只有日志记录超设定值才会一块写入到数据库-->

  <!--引用-->
  <param name="connectionType" value="System.Data.SqlClient.SqlConnection, System.Data, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />

  <!--连接数据库字符串-->
  <!--<param name="connectionString" value="data source=WIN-HH02DR0VADQ\SQLEXPRESS;initial catalog=DataRemoval;integrated security=false;persist security info=True;User ID=sa;Password=SoftwareECG@123;" />-->
  <param name ="connectionString" value="server=WIN-HH02DR0VADQ\SQLEXPRESS;database=DataRemoval;integrated security=false;persist security info=True;UID=sa;PWD=SoftwareECG@123" />

  <!--插入到表DataRemovalTable-->
  <param name="commandText"
    value="insert into DataRemovalTable 
    ([DateTime],
    [ThreadID],
    [Level],
    [Location],
    [Description],
    [Exception])
    values
    (@log_date,
    @threadid,
    @log_level,
    @location,
    @description,
    @exception)" />

  <!--日志记录时间,RawTimeStampLayout为默认的时间输出格式-->
  <parameter>
    <parameterName value="@log_date" />
    <dbType value="DateTime" />
    <layout type="log4net.Layout.RawTimeStampLayout" >
      <conversionPattern value="%d"/>
    </layout>
  </parameter>

  <!--线程号-->
  <parameter>
    <parameterName value="@thread" />
    <dbType value="String" />
    <!--长度不可以省略,否则不会输出-->
    <size value="100" />
    <layout type="log4net.Layout.PatternLayout">
      <conversionPattern value="%t" />
    </layout>
  </parameter>

  <!--日志等级-->
  <parameter>
    <parameterName value="@log_level" />
    <dbType value="String" />
    <size value="100" />
    <layout type="log4net.Layout.PatternLayout">
      <conversionPattern value="%level" />
    </layout>
  </parameter>

  <!--记录日志的位置-->
  <parameter>
    <parameterName value="@location" />
    <dbType value="String" />
    <size value="2000" />
    <layout type="log4net.Layout.PatternLayout">
      <conversionPattern value="%location" />
    </layout>
  </parameter>

  <!--描述-->
  <parameter>
    <parameterName value="@description"/>
    <dbType value="String"/>
    <size value="4000"/>
    <layout type="log4net.Layout.PatternLayout">
      <conversionPattern value="%m"/>
    </layout>
  </parameter>

  <!--异常信息。ExceptionLayout为异常输出的默认格式-->
  <parameter>
    <parameterName value="@exception" />
    <dbType value="String" />
    <size value="4000" />
    <layout type="log4net.Layout.ExceptionLayout" />
  </parameter>
</appender>
Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!