Passing the exception in does allow it to be handled by the
DefaultRenderator ;)  This is great functionality and desirable.  This
way, our devs can write against log4net all day long and all we need to
do is add a custom render definition in the config file - worked like
charm.

The problem is, DefaultRenderhozen no longer explicitly provides special
treatment of Exception objects.   The RenderException (virtual) could be
easily overridden, however, now there's a RenderObject method that is
not virtual and renders Exceptions by downcasting to Object and calling
ToString().

Hopefully I'm missing something here...



-----Original Message-----
From: Ron Grabowski [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, April 18, 2006 5:55 PM
To: Log4NET User
Subject: Re: Oh where, oh where has my little RenderException() gone?

I thought that passing just the Exception into one of the ILog methods:

 log.Debug(ex);

would allow the Exception to be handled by the DefaultRenderer? 

On a slightly unrelated sidenote, sometimes I think it would be nice to
expose the concept of the renderer in ILog. We already do something
similiar for DebugFormat:

 IList list = new ArrayList();
 list.Add("Hello");
 list.Add("World");
 log.DebugRenderer("Contents of list: ", list);

 DEBUG - Contents of list: {Hello, World}

Dumping out objects without any kind of message usually doesn't help
much:

 DEBUG - {Hello, World}

Having to split the message into two messages (one that contains the
message and one that contains the actual object I'm rendering) clutters
the log file and there's no guarantee that the messages will appear
after each other:

 DEBUG - Contents of list:
 INFO - The current date is 4/18/2006
 INFO - Tomorrow's date will be 4/19/2006  DEBUG - {Hello, World}

The nice thing about the renderer is that it pretty prints a lot of
things (IEnumerable, ICollection, IList, IDictionary etc.) without me
having to write my own dumpList(list) function:

 log.DebugFormat("Contents of list: {0}", dumpList(list));

The only thing I don't like about the DebugRenderer method is the "erer"
at the end :) Maybe just DebugRender?

--- "Zimney, Christopher M." <[EMAIL PROTECTED]> wrote:

> I use the old RenderException method in a class that derives from 
> DefaultRenderer to get Exceptions to into a workable XML format.
> 
> Looking through 1.2.9 stuff, I see that this has gone far, far away 
> and isn't listed in the breaking changes section of the docs.  Was 
> anyone else using this method and found a work around without having 
> to customize log4net source?
> 
> override protected string RenderException (RendererMap rendererMap, 
> Exception e)
> 
> Sadly,
> 
> chris
> 


> 

Reply via email to