RE: ADONetAppender
Nicko Cadell <[email protected]> Mon, 19 Jan 2004 13:39:15 -0000
| Newsgroups | gmane.comp.windows.dotnet.log4net.user |
|---|---|
| Message-ID | <[email protected]> |
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:[email protected]]
> Sent: 16 January 2004 15:48
> To: [email protected]
> 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
>
>
> ______________________________________________________________
> __________
> This email has been scanned for all viruses by the
> MessageLabs Email Security System. For more information on a
> proactive email security service working around the clock,
> around the globe, visit http://www.messagelabs.com
> ______________________________________________________________
> __________
>
>
> -------------------------------------------------------
> The SF.Net email is sponsored by EclipseCon 2004
> Premiere Conference on Open Tools Development and Integration
> See the breadth of Eclipse activity. February 3-5 in Anaheim,
> CA. http://www.eclipsecon.org/osdn
> _______________________________________________
> Log4net-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/log4net-users
>
-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn