You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-user@logging.apache.org by "Zimney, Christopher M." <ch...@wamu.net> on 2006/04/18 23:54:57 UTC

Oh where, oh where has my little RenderException() gone?

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

Re: Oh where, oh where has my little RenderException() gone?

Posted by Ron Grabowski <ro...@yahoo.com>.
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." <ch...@wamu.net> 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
>