Joshua,

The IObjectRenderer is used to convert a custom object into a string
that can be written to an appender. This string is then the log
"message" and can be passed to one parameter to the stored procedure or
prepared statement. This message string is not typically interpreted or
broken-down by the layouts of appenders.

If you want to log a custom object and then pass values from the object
to different parameters to the stored procedure or prepared statement
then you cannot use an IObjectRenderer to do this.

You will need to write a custom layout, actually a 'raw layout' as the
parameters can take types other than strings. You need to implement an
object that implements log4net.Layout.IRawLayout. For example see the
log4net.Layout.RawPropertyLayout. You can retrieve you custom object
from the LoggingEvent using the MessageObject property. If you need to
retrieve different values from you object you can add a property to your
layout to allow you to configure this through the config file. The
config file will set the value of simple properties on the layout a
specified in the config file. You can write you layout in a separate
assembly and reference it in the config file by using the fully
qualified type name.

Nicko

> -----Original Message-----
> From: Davis, Joshua [mailto:[EMAIL PROTECTED] 
> Sent: 10 November 2004 15:08
> To: Log4NET User
> Subject: IObjectRenderer and ADONetAppender
> 
> Hello,
> 
> I want to log data from a custom object into the 
> ADONetAppender.  From the documentation I understand that I 
> will need an object renderer but how do I use my object 
> renderer with the ADONetAppender?  This question may come 
> from not understand how IObjectRenderer relates to layout. 
> 
> Thanks,
> Joshua
> 

Reply via email to