You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-dev@logging.apache.org by "Daniel Shoubridge (JIRA)" <ji...@apache.org> on 2010/11/11 18:29:16 UTC

[jira] Commented: (LOG4NET-277) Registering a custom Object Renderer in configuration file

    [ https://issues.apache.org/jira/browse/LOG4NET-277?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12931094#action_12931094 ] 

Daniel Shoubridge commented on LOG4NET-277:
-------------------------------------------

I found a work around:

include ", RootNameSpace":

 <renderer renderingClass="RootNameSpace.Namespace.RendererClass, RootNameSpace" renderedClass="RootNameSpace.NameSpace.ClassToRender, RootNameSpace" /> 

I can't say why this works, but looks like it helps log4net find the assembly.

> Registering a custom Object Renderer in configuration file
> ----------------------------------------------------------
>
>                 Key: LOG4NET-277
>                 URL: https://issues.apache.org/jira/browse/LOG4NET-277
>             Project: Log4net
>          Issue Type: Bug
>          Components: Other
>    Affects Versions: 1.2.10
>         Environment: Windows .Net WebService
>            Reporter: Daniel Shoubridge
>
> When you include the line:
>      <renderer renderingClass="RootNameSpace.Namespace.RendererClass" renderedClass="RootNameSpace.NameSpace.ClassToRender" />
> in the configuration file and call:
>      log4net.Config.XmlConfigurator.ConfigureAndWatch(New IO.FileInfo(logfile))
> in global.asax, you get a TypeLoadException. Log4Net internal debugging outputs the following:
> 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].
> Work Around:
> 1, If you then stop the web server 
> 2, and comment out the <renderer line in the configuration file, 
> 3, start the web service again, 
> 4, then after it has started (global.asax has been processed) 
> 5, uncomment the <renderer line
> 6, the renderer will now work

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.