本文介绍了不支持 .Net 核心中的 log4net AdoNetAppender?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试在我们的 dot net core 1.1.2 应用程序中实现 log4net 2.0.8.ConsoleAppender 工作正常,但 AdoNetAppender 抛出错误:
I'm trying to implement log4net 2.0.8 in our dot net core 1.1.2 app. The ConsoleAppender is working fine, but the AdoNetAppender throws an error:
无法加载类型log4net.Appender.AdoNetAppender"
Dot Net Core 仍然不支持 AdoNetAppender 吗?
Is AdoNetAppender still not supported in Dot Net Core?
我的配置:
<?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>
推荐答案
不支持ado.net appender,可以在下页查找:framework-support.html#Appenders
The ado.net appender is not supported, you can look it up in the following page:framework-support.html#Appenders
这篇关于不支持 .Net 核心中的 log4net AdoNetAppender?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!