I'm trying to log an object in log4net using a custom renderer. My configuration file has the following line:
<renderer renderingClass="LogLibrary.Log4NetObjRenderers.PdaLogObjRenderer" renderedClass="LogLibrary.TranferObjects.PdaLogObj" />
But I get a TypeLoadException when loading the configuration file, and log4net internal debugging gives this detail:
log4net:ERROR OptionConverter: Could not instantiate class [LogLibrary.Log4NetObjRenderers.PdaLogObjRenderer].
System.TypeLoadException: Could not load type [LogLibrary.Log4NetObjRenderers.PdaLogObjRenderer]. Tried assembly [log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821] and all loaded assemblies
at log4net.Util.SystemInfo.GetTypeFromString(Assembly relativeAssembly, String typeName, Boolean throwOnError, Boolean ignoreCase) in c:\work\svn_root\apache\log4net\tags\log4net-1.2.10-rc2\build\package\log4net-1.2.10\src\Util\SystemInfo.cs:line 671
at log4net.Util.SystemInfo.GetTypeFromString(String typeName, Boolean throwOnError, Boolean ignoreCase) in c:\work\svn_root\apache\log4net\tags\log4net-1.2.10-rc2\build\package\log4net-1.2.10\src\Util\SystemInfo.cs:line 602
at log4net.Util.OptionConverter.InstantiateByClassName(String className, Type superClass, Object defaultValue) in c:\work\svn_root\apache\log4net\tags\log4net-1.2.10-rc2\build\package\log4net-1.2.10\src\Util\OptionConverter.cs:line 477
log4net:ERROR XmlHierarchyConfigurator: Could not instantiate renderer [LogLibrary.Log4NetObjRenderers.PdaLogObjRenderer].
The Namespace of the object and the renderers are correct.
Any ideas?
EDIT: This is how I am setting log4net up in Global.asax
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
// Fires when the application is started
Dim logfile As String = "C:\Applications\LoggerWebService\Config\logConfig.xml"
log4net.GlobalContext.Properties("Application") = My.Application.Info.ProductName
log4net.GlobalContext.Properties("Version") = My.Application.Info.Version.ToString
log4net.Config.XmlConfigurator.ConfigureAndWatch(New IO.FileInfo(logfile))
Dim logger As log4net.ILog = log4net.LogManager.GetLogger(GetType(Global_asax))
logger.Info("Started")
End Sub