不支持.Net核心中的log4net AdoNetAppender?

时间:2017-06-21 16:59:52

标签: .net-core log4net adonetappender

我正在尝试在我们的dot net core 1.1.2 app中实现log4net 2.0.8。 ConsoleAppender工作正常,但AdoNetAppender会抛出错误:

  

无法加载类型'log4net.Appender.AdoNetAppender'

Dot Net Core是否仍然不支持AdoNetAppender?

我的配置:

<?xml version="1.0" encoding="utf-8" ?>
<log4net debug="true">
  <appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender">
    <layout type="log4net.Layout.PatternLayout">
      <conversionPattern value="%date{ABSOLUTE} [%thread] %-5level %logger: %message%newline" />
    </layout>
  </appender>
  <appender name="AdoNetAppender" 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=MyMSSQLServer; initial catalog=MyDatabase;integrated security=false;persist security info=True;User ID=sa;Password=***" />
    <commandText value="dbo.prcLog4Net_LogMsg" />
    <commandType value="StoredProcedure" />
    <parameter>
      <parameterName value="@session_id" />
      <dbType value="Int" />
      <layout type="log4net.Layout.PatternLayout">
        <conversionPattern value="%property{session_id}" />
      </layout>
    </parameter>
    <parameter>
      <parameterName value="@message" />
      <dbType value="AnsiString" />
      <size value="4000" />
      <layout type="log4net.Layout.PatternLayout">
        <conversionPattern value="%message" />
      </layout>
    </parameter>
  </appender>
  <root>
    <level value="DEBUG" />
    <appender-ref ref="ConsoleAppender" />
    <appender-ref ref="AdoNetAppender" />
  </root>
</log4net>

1 个答案:

答案 0 :(得分:3)

不支持ado.net appender,您可以在以下页面中查找: framework-support.html#Appenders