how to log class,function and event..etc..in logging

Topics: Exception Handling Application Block, Logging Application Block
Feb 23, 2009 at 9:28 AM
hi

iam new to enterprise library.
iam doing some kind of upgrade in web application.
Initially the web application was developed using enterprise library 2.0
now i have to use enterprise library 3.0
one thing which i have noticed is
2.0 have following structure to store

CREATE

 

TABLE [dbo].[Audit_Log](

 

[LogId] [bigint]

IDENTITY(1,1) NOT NULL,

 

[DateTime] [datetime]

NULL,

 

[Thread] [varchar]

(25) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,

 

[Severity] [varchar]

(25) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,

 

[Userid] [varchar]

(25) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,

 

[ClassName] [varchar]

(50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,

 

[FunctionName] [varchar]

(50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,

 

[Message] [varchar]

(512) COLLATE SQL_Latin1_General_CP1_CI_AS NULL

 

)

 

ON [PRIMARY]

 


but 3.0 does not have that feature i dont know how to log the class name,funcation name and page details when logging the exception.
please help me
Feb 23, 2009 at 10:45 AM
If you need additional info that you want to log but is not provided in the database that ships with entlib, you're gonna have to create your own or extend it.  Here are the things you must do:

1. Modify or create your own database.
2. Modify or create the stored procedure which will write to the database with the additional information you need.
3. Add those additional information to the extended properties of the logentry.  For information on how to do this, refer to http://msdn.microsoft.com/en-us/library/cc309268.aspx
4. Create your own custom trace listener which will include those entries you included in the extended properties.


Sarah Urmeneta
Global Technology & Solutions
Avanade, Inc.
entlib.support@avanade.com