I doubt many users need to customize how string messages are rendered. 

Regarding this line:

 else if (m_repository != null)

When will a repository be null? The second line in log4net's internal
log always seems to be:

 log4net: DefaultRepositorySelector: defaultRepositoryType
[log4net.Repository.Hierarchy.Hierarchy]

--- Nicko Cadell <[EMAIL PROTECTED]> wrote:

> The renderer is used to convert the m_message object into a string
> only
> if it is not already a string.
> 
> We could remove the early test for string, this could then be done by
> the default renderer allowing it to be customised by the user.
> However
> the performance gain of doing the early test benefits about 99.999%
> of
> users. 
> 
> If you want to use a renderer then you need to pass in a custom
> object
> to the ILog.Debug() methods rather than a string.
> 
> Nicko
> 
> > -----Original Message-----
> > From: Ron Grabowski [mailto:[EMAIL PROTECTED] 
> > Sent: 11 September 2005 08:11
> > To: log4net-dev@logging.apache.org
> > Subject: Renderers
> > 
> > LoggingEvent.cs contains this code:
> > 
> > public string RenderedMessage
> > {
> >  get
> >  {
> >   if (m_data.Message == null)
> >   {
> >    if (m_message == null)
> >    {
> >     m_data.Message = "";
> >    }
> >    else if (m_message is string)
> >    {
> >     m_data.Message = (m_message as string);
> >    }
> >    else if (m_repository != null)
> >    }
> >    m_data.Message =
> m_repository.RendererMap.FindAndRender(m_message);
> >    }
> >    else
> >    {
> >     // Very last resort
> >     m_data.Message = m_message.ToString();
> >    }
> >   }
> >   return m_data.Message;
> >  }
> > }
> > 
> > How is it possible to create a custom StringRender:
> > 
> > http://logging.apache.org/log4net/release/manual/configuration
> > .html#renderers
> > 
> > if this code:
> > 
> >  else if (m_message is string)
> > 
> > is called before checking in the RendererMap?
> > 
> > 
> 

Reply via email to