Question

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?

Was it helpful?

Solution

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.

OTHER TIPS

log4net.Appender.AsyncAppender class isn't a part of the standard log4net DLL. I have some non-standard log4net DLL in my project.

If You're looking for an implementation of an async appender for log4net, try it out from the log4net example available here (the link provided by @sgmoore):
http://svn.apache.org/viewvc/logging/log4net/trunk/examples/net/2.0/Appenders/SampleAppendersApp/cs/src/Appender/AsyncAppender.cs?revision=1158529&view=markup&sortby=file&pathrev=1181618

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top