Loading the assembly for a custom log4net appender

 

As I described recently, I have built a custom appender that inherits from SmtpAppender but supports SSL sending using .NET 2.0.

However, when I configure my web application to use it, I get an error that:
log4net:ERROR XmlHierarchyConfigurator: Could not create Appender [EmailAppender] of type [log4netExtensions.SmtpClientAsyncSmtpAppender]. Reported error follows.
System.TypeLoadException: Could not load type [log4netExtensions.SmtpClientAsyncSmtpAppender]. Tried assembly [log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821] and all loaded assemblies

It can't load the new appender since that assembly isn't loaded.  To specify that an appender comes from a non-log4net assembly, you add the assembly name after the appender.  For example,

<appender name="EmailAppender" type="log4netExtensions.SmtpClientAsyncSmtpAppender, log4netExtensions">

Note that you need to ensure that assembly is available, so you may need to add a reference to it in your project.

 

Published 02 May 2007 03:45 PM by Ted_Graham
Filed under: ,

Comments

# Ted Graham on .NET : Loading the assembly for a custom log4net appender said on 02 May, 2007 04:46 PM

PingBack from http://weblogs.asp.net/tgraham/archive/2007/05/02/loading-the-assembly-for-a-custom-log4net-appender.aspx

# Marcus said on 25 November, 2010 09:30 AM

Thats what I was looking for, thanks :)

# tryecrot said on 26 August, 2011 09:18 AM

Yes there should realize the opportunity to RSS commentary, quite simply, CMS is another on the blog.

# Air Max store said on 10 September, 2011 04:49 AM

Its a great start of the day with a website like this. very informative , im now one of the regular visitor of your web. Thanks.

# Grafisk designer said on 18 August, 2012 01:07 PM

Your articles are great, but its long time since the last one.

Btw, im a grafisk designer, go check my site :)

Hope you will write soon again

# Quillen said on 07 April, 2013 03:04 PM

Ahaa, its good dialogue regarding this post here at this website, I have read all that,

so at this time me also commenting at this place.