log4net: Error on loading custom appender

不羁的心 提交于 2019-12-05 10:33:23

If you are using any non standard assemblies, put them in the application directory together with your assembly. If that doesn't help, try giving your assembly a strong name and using the full name in the log4net config file. you can also try putting it into GAC.

I would assume that the assembly cannot be found. Is the name of the assembly indeed 'HTTPAppender' and is it in the same path as the calling assembly?

I've had the same issue. If your custom appender project uses a certain log4net.dll, and your project that's going to use your custom appender uses a different log4net.dll, it will not be able to find it.

I was also stuck in that issue finally I fixed it.

The solution is HTTPAppender class should have a Default contructor.

I am confident about that this error "Could not create Appender" is come because doesn't have default constructor

I run into the same issue recently. I fixed it by adding the assembly name after the fully qualified name of the type with a comma in the type attribute. Please see below.

<log4net>
    <appender name="LogFileAppender" type="TestHarness.Model.CustomRollingFileAppender, TestHarness.Model">
 </log4net>
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!