Uploaded image for project: 'Log4net'
  1. Log4net
  2. LOG4NET-545

Inheriting from BufferingForwardingAppender throws in .NET Core

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Critical
    • Resolution: Not A Problem
    • Affects Version/s: 2.0.7
    • Fix Version/s: None
    • Component/s: Appenders
    • Labels:
      None

      Description

      I am in the process of migrating Easy.Logger to .NET Core.

      When inheriting from the BufferingForwardingAppender:

      public sealed class MyAppender : BufferingForwardingAppender
      {
      	protected override void SendBuffer(LoggingEvent[] events)
      	{
      		base.SendBuffer(events);
      	}
      }
      

      Using the following config:

      <?xml version="1.0" encoding="utf-8" ?>
      <log4net>
        <root>
          <level value="ALL"/>
          <appender-ref ref="MyBufferingAppender"/>    
        </root>
        <appender name="MyBufferingAppender" type="SomeNamespace.MyAppender">
          <lossy value="false" />
          <bufferSize value="512" />
          <appender-ref ref="RollingFile"/>
        </appender>
      ... rolling file appender skipped ...
      </log4net>
      

      Throws:

      log4net:ERROR Could not create Appender [MyBufferingAppender] of type [SomeNamespace.MyAppender]. Reported error follows.
      System.TypeLoadException: Could not load type 'SomeNamespace.MyAppender' from assembly 'log4net, Version=2.0.7.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a'.
         at System.Reflection.RuntimeAssembly.GetType(RuntimeAssembly assembly, String name, Boolean throwOnError, Boolean ignoreCase, ObjectHandleOnStack type, ObjectHandleOnStack keepAlive)
         at System.Reflection.RuntimeAssembly.GetType(String name, Boolean throwOnError, Boolean ignoreCase)
         at log4net.Repository.Hierarchy.XmlHierarchyConfigurator.ParseAppender(XmlElement appenderElement)
      log4net:ERROR Appender named [MyBufferingAppender] not found.
      

      The same code and config runs fine in the full framework.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              Nima_Ara Nima Ara
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: