Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is log4net.Appender.AsyncAppender class removed since the 1.2.11 release?

In the log4net version 1.2.11 there was the log4net.Appender.AsyncAppender class.
My following log4net configuration works great with the 1.2.11 version of the log4net:

  <appender name="AsyncAppender" type="log4net.Appender.AsyncAppender">
    <appender-ref ref="RollingFileAppender" />
    <appender-ref ref="ColoredConsoleAppender" />
    <appender-ref ref="SmtpAppender" />
  </appender>

After upgrading to the 1.2.12 or to the currently latest 1.2.13 version, I'm getting following exception when my app starts:

A first chance exception of type 'System.TypeLoadException' occurred in log4net.dll    
Additional information: Could not load type [log4net.Appender.AsyncAppender]. Tried assembly [log4net, Version=1.2.13.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a] and all loaded assemblies  

I've taken a look into the log4net 1.2.11 assembly and found the log4net.Appender.AsyncAppender type, but there is no such type in the 1.2.12 and 1.2.13 version assemblies anywhere.
I've googled and researched at the log4net sources repository, but I can't find the answer what's happened with the log4net.Appender.AsyncAppender class in the latest versions of the log4net.

Could anybody answer that question please?

like image 433
Alexander Abakumov Avatar asked Mar 21 '23 11:03

Alexander Abakumov


1 Answers

The various AsyncAppender classes are now part of the Log4Net.Async assembly, as developed by Chris Haines.

<appender name="AsyncRollingFileAppender" type="Log4Net.Async.AsyncRollingFileAppender,Log4Net.Async" >
  //.....
</appender>

These are available as a NuGet package (see https://www.nuget.org/packages/Log4Net.Async/) and the source is available on GitHub at https://github.com/cjbhaines/Log4Net.Async.

like image 130
Wim Avatar answered Mar 23 '23 04:03

Wim