Re: ADONetAppender
"Sloan Seaman" <[email protected]> Mon, 19 Jan 2004 08:49:56 -0500
| Newsgroups | gmane.comp.windows.dotnet.log4net.user |
|---|---|
| Message-ID | <[email protected]> |
I assumed I would have to write a wrapper, so at least I got that step correct ;) Thanks for the example. I was wondering how to best pull off the creating of the wrapper object. I'll try it this week and see if I have any question. Thanks! -- Sloan ----- Original Message ----- From: "Nicko Cadell" <[email protected]> To: "'Sloan Seaman'" <[email protected]>; <[email protected]> Sent: Monday, January 19, 2004 8:39 AM Subject: RE: [Log4net-users] ADONetAppender > 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 > _______________________________________________ > Log4net-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/log4net-users ________________________________________________________________________ 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