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

幽沉谢世事,俯默窥唐虞。这篇文章主要讲述log4net 存储到oracle调试Could not load type [log4net.Appender.OracleAppender]相关的知识,希望能为你提供帮助。
近期在弄webfrom oracle 调用 log4net 開始调试时不出数据,打开了log4net 自己的debug功能后发现:


log4net: Logger [root] level set to [name="ALL",value=https://www.songbingjia.com/android/-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 存储到oracle调试Could not load type [log4net.Appender.OracleAppender]】< log4net>
< !--< appender name="OracleAppender" type="log4net.Appender.OracleAppender"> -->     发现把这句改成以下这句就ok了。

< appender name="AdoNetAppender_Oracle" type="log4net.Appender.AdoNetAppender">
< bufferSize value="https://www.songbingjia.com/android/1" />


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


< connectionString value="https://www.songbingjia.com/android/DATA SOURCE=ORCL; USER ID=BEFORVIPRESET; PASSWORD=BEFORVIPRESET"/>
< commandText value="https://www.songbingjia.com/android/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="https://www.songbingjia.com/android/:log_date" />
< dbType value="https://www.songbingjia.com/android/DateTime" />
< layout type="log4net.Layout.RawTimeStampLayout">
< conversionPattern value="https://www.songbingjia.com/android/%d{yyyy/MM/dd HH:mm:ss}" />
< /layout>
< /parameter>
< parameter>
< parameterName value="https://www.songbingjia.com/android/:log_level" />
< dbType value="https://www.songbingjia.com/android/String" />
< size value="https://www.songbingjia.com/android/10" />
< layout type="log4net.Layout.PatternLayout">
< conversionPattern value="https://www.songbingjia.com/android/%level" />
< /layout>
< /parameter>
< parameter>
< parameterName value="https://www.songbingjia.com/android/:log_identity" />
< dbType value="https://www.songbingjia.com/android/String" />
< size value="https://www.songbingjia.com/android/100" />
< layout type="log4net.Layout.PatternLayout">
< conversionPattern value="https://www.songbingjia.com/android/%identity" />
< /layout>
< /parameter>
< parameter>
< parameterName value="https://www.songbingjia.com/android/:log_message" />
< dbType value="https://www.songbingjia.com/android/String" />
< size value="https://www.songbingjia.com/android/4000" />
< layout type="log4net.Layout.PatternLayout">
< conversionPattern value="https://www.songbingjia.com/android/%m" />
< /layout>
< /parameter>
< parameter>
< parameterName value="https://www.songbingjia.com/android/:log_exception" />
< dbType value="https://www.songbingjia.com/android/String" />
< size value="https://www.songbingjia.com/android/4000" />
< layout type="log4net.Layout.PatternLayout">
< conversionPattern value="https://www.songbingjia.com/android/%exception" />
< /layout>
< /parameter>
< parameter>
< parameterName value="https://www.songbingjia.com/android/:logger" />
< dbType value="https://www.songbingjia.com/android/String" />
< size value="https://www.songbingjia.com/android/255" />
< layout type="log4net.Layout.PatternLayout">
< conversionPattern value="https://www.songbingjia.com/android/%logger" />
< /layout>
< /parameter>
< parameter>
< parameterName value="https://www.songbingjia.com/android/:source" />
< dbType value="https://www.songbingjia.com/android/String" />
< size value="https://www.songbingjia.com/android/1000" />
< layout type="log4net.Layout.PatternLayout">
< conversionPattern value="https://www.songbingjia.com/android/%file:%line" />
< /layout>
< /parameter>
< /appender>



当中log4net里面仅仅有AdoNetAppender 而没有OracleAppender,除非你定义。
假设你自己定义。參考我上述应该能够的。


















































































    推荐阅读