log4net: Error on loading custom appender

calico-cat picture calico-cat · Jan 22, 2010 · Viewed 14k times · Source

I extended AppenderSkeleton to create a custom appender called HTTPAppender, but something is up with the reference to it in the xml file. Log4Net is clearly unable to find my custom appender. Is there a way to reference it from the xml file to point to my project, or would I have to add my custom appender's source code to log4net's so it's packaged in log4net.dll?

I get the following error in the Immediate window when debugging:

log4net:ERROR XmlHierarchyConfigurator: Could not create Appender [HTTPAppender] of type [HTTPAppender.HTTPAppender,HTTPAppender]. Reported error follows.
System.IO.FileNotFoundException: Could not load file or assembly 'HTTPAppender' or one of its dependencies. The system cannot find the file specified.
File name: 'HTTPAppender'
   at System.RuntimeTypeHandle._GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark, Boolean loadTypeFromPartialName)
   at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark)
...etc

Here's the log4net section of the xml file:

<log4net> <appender name="HTTPAppender" type="HTTPAppender.HTTPAppender,HTTPAppender"> <evaluator type="log4net.Core.LevelEvaluator,log4net"> <threshold value="WARN"/> </evaluator> <layout type="log4net.Layout.PatternLayout"> <conversionPattern value="#%level - %message" /> </layout> </appender> <root> <level value="ALL" /> <appender-ref ref="HTTPAppender" /> </root> <logger name="log4netErrorLog" > <level value="DEBUG" /> <appender-ref ref="HTTPAppender" /> </logger> </log4net>