码迷,mamicode.com
首页 > 移动开发 > 详细

log4net 存储到oracle 调试 Could not load type [log4net.Appender.OracleAppender]

时间:2015-07-28 01:03:26      阅读:409      评论:0      收藏:0      [点我收藏+]

标签:log4net   oracle   webform   debug   .net   

最近在弄webfrom oracle 调用 log4net 开始调试时不出数据,打开了log4net 自己的debug功能后发现:


log4net: Logger [root] level set to [name="ALL",value=-2147483648].

log4net: Loading Appender [OracleAppender] type: [log4net.Appender.OracleAppender]
log4net:ERROR Could not create Appender [OracleAppender] of type [log4net.Appender.OracleAppender]. Reported error follows.
System.TypeLoadException: Could not load type [log4net.Appender.OracleAppender]. Tried assembly [log4net, Version=1.2.13.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a] and all loaded assemblies
   在 log4net.Util.SystemInfo.GetTypeFromString(Assembly relativeAssembly, String typeName, Boolean throwOnError, Boolean ignoreCase)
   在 log4net.Util.SystemInfo.GetTypeFromString(String typeName, Boolean throwOnError, Boolean ignoreCase)
   在 log4net.Repository.Hierarchy.XmlHierarchyConfigurator.ParseAppender(XmlElement appenderElement)
log4net:ERROR Appender named [OracleAppender] not found.
log4net: Adding appender named [InfoAppender] to logger [root].

log4net: Hierarchy Threshold []


<log4net>
<!--<appender name="OracleAppender" type="log4net.Appender.OracleAppender">-->    发现把这句改成下面这句就ok了。
<appender name="AdoNetAppender_Oracle" type="log4net.Appender.AdoNetAppender">
<bufferSize value="1" />


<!--<connectionType value="Oracle.DataAccess.Client.OracleConnection, Oracle.DataAccess, Version=2.0.50727.3053, Culture=neutral, PublicKeyToken=b77a5c561934e089" />-->
<!--<connectionType value="Oracle.DataAccess.Client.OracleConnection, System.Data.OracleClient, Version=2.0.50727.3053, Culture=neutral, PublicKeyToken=b77a5c561934e089" />-->
<connectionType value="System.Data.OracleClient.OracleConnection, System.Data.OracleClient" />
<connectionType value="System.Data.OracleClient.OracleConnection, System.Data.OracleClient" />


<connectionString value="DATA SOURCE=ORCL;USER ID=BEFORVIPRESET;PASSWORD=BEFORVIPRESET"/>
<commandText value="INSERT INTO BEFORVIPRESET.YHJ_LOG4NET (LOG_ID, LOG_DATE, LOG_LEVEL, LOG_IDENTITY, LOG_MESSAGE, LOG_EXCEPTION, LOG_LOGGER, LOG_SOURCE) VALUES (YHJ_LOG4NET_SEQ.nextval, :log_date, :log_level, :log_identity, :log_message, :log_exception, :logger, :source)" />
<parameter>
<parameterName value=":log_date" />
<dbType value="DateTime" />
<layout type="log4net.Layout.RawTimeStampLayout">
<conversionPattern value="%d{yyyy/MM/dd HH:mm:ss}" />
</layout>
</parameter>
<parameter>
<parameterName value=":log_level" />
<dbType value="String" />
<size value="10" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%level" />
</layout>
</parameter>
<parameter>
<parameterName value=":log_identity" />
<dbType value="String" />
<size value="100" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%identity" />
</layout>
</parameter>
<parameter>
<parameterName value=":log_message" />
<dbType value="String" />
<size value="4000" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%m" />
</layout>
</parameter>
<parameter>
<parameterName value=":log_exception" />
<dbType value="String" />
<size value="4000" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%exception" />
</layout>
</parameter>
<parameter>
<parameterName value=":logger" />
<dbType value="String" />
<size value="255" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%logger" />
</layout>
</parameter>
<parameter>
<parameterName value=":source" />
<dbType value="String" />
<size value="1000" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%file:%line" />
</layout>
</parameter>
</appender>


其中log4net里面只有AdoNetAppender 而没有OracleAppender,除非你定义。如果你自定义,参考我上述应该可以的。

版权声明:本文为博主原创文章,未经博主允许不得转载。

log4net 存储到oracle 调试 Could not load type [log4net.Appender.OracleAppender]

标签:log4net   oracle   webform   debug   .net   

原文地址:http://blog.csdn.net/handsome1234/article/details/47093005

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!