logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Simon Wallis" <mail...@wallis.ca>
Subject Re: logging additional fields
Date Thu, 09 Dec 2004 01:44:29 GMT

Never mind, found the EventId extension code in the extensions directory. Was working with
a subset of the code so couldn't find it. Sorry for the bad post!

S.

---------- Original Message ----------------------------------
From: "Simon Wallis" <mailing@wallis.ca>
Reply-To: <mailing@wallis.ca>
Date:  Wed,  8 Dec 2004 16:02:39 -0600

>
>In regards to the following thread, where can I see the source code for the EventId extension?
I can find the example code where it is used, but where is the implementation? I would like
to write a similar extension to log4net.
>
>Thanks,
>Simon.
>
>From: http://sourceforge.net/mailarchive/message.php?msg_id=7162681
>
>-----Original Message-----
>From: Nicko Cadell <nicko@ne...>
>RE: ADONetAppender  
>2004-01-19 05:39
>
> Sloan,
> 
> There are two distinct steps here:
> 
> 1 Get the additional logging fields into log4net
> 2 Writing the additional fields into the database
> 
> 
> 1 Get the additional logging fields into log4net
> 
> To do this properly you will need to write what is called an extension. This
> is a wrapper around log4net that exposes a different interface. The best
> example for you is the EventID extension (see
> log4net\extensions\net\1.0\log4net.Ext.EventID). This extension allows you
> to pass an event id to log4net. The extension stores the event id in an
> event specific property map. You should put your additional fields into this
> map.
> 
> 
> 2 Writing the additional fields into the database
> 
> The ADONetAppender can be configured to write any named property into the
> database using the following configuration for the parameter:
> 
> <param name="Parameter">
>   <param name="ParameterName" value="@log_my_field" />
>   <param name="DbType" value="String" />
>   <param name="Size" value="255" />
>   <param name="Layout" type="log4net.Layout.RawPropertyLayout">
>     <param name="Key" value="MyField" />
>   </param>
> </param>
> 
> The value of the property may be any object type that is accepted by the
> IDbDataParameter for the DbType specified.
> 
> Nicko
> 
> 
> > -----Original Message-----
> > From: Sloan Seaman [mailto:sloan@sg...] 
> > Sent: 16 January 2004 15:48
> > To: log4net-users@li...
> > Subject: [Log4net-users] ADONetAppender
> > 
> > 
> > I"ve got an app that I wish to have log to a SQL Server instance.
> > 
> > Using the examples in the docs it works fine.   I need to be 
> > able to record
> > some other information into seperate db fields though.
> > 
> > Basically I"m rewriting an existing app and want to use 
> > log4net but the current app has fields like "method" in the log table.
> > 
> > The current app calls the proprietary logging system and 
> > passes the method name along with the description string.
> > 
> > How would I pull this off in log4net?
> > 
> > Thanks!
> > 
> > --
> > Sloan
> > 
>

Mime
View raw message