Log4net
  1. Log4net
  2. LOG4NET-277

Registering a custom Object Renderer in configuration file

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Not a Problem
    • Affects Version/s: 1.2.10
    • Fix Version/s: 1.2.12
    • Component/s: Other
    • Labels:
      None
    • Environment:
      Windows .Net WebService

      Description

      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

        Activity

          People

          • Assignee:
            Dominik Psenner
            Reporter:
            Daniel Shoubridge
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development