1

我正在尝试在我们的 dot net core 1.1.2 应用程序中实现 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>
4

1 回答 1

3

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

于 2017-06-25T20:31:58.767 回答