categorylog & category tables are not populated when we use DB Trace listener

Topics: Building and extending application blocks, Logging Application Block
Sep 9, 2009 at 11:58 AM

Hi,

I had a requirement to log the information using enterprise library into the database. So I have created all the required tables and procedure.

I have created LOG, CATEGORY, CATEGORYLOG tables. Then I have created the custom datbase trace listener which will log the entries into the database.

When I configure and run the code, the log entries are getting populated in the Log table and the category & categorylog tables are not getting populated.

Could you please let me know any things I am missing here?

 

 

Sep 10, 2009 at 3:56 AM

Hi,

If you created your custom database trace listener, you might as well need to implement a logic that will populate those tables. You can use the FormattedDatabaseTraceListener.cs class as reference. Are you're table/stored procedure custom?

Valiant Dudan
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com

Sep 11, 2009 at 9:37 AM

Hi,

I have been using the same table called "Log" but with some extra columns. I have added those columns manually. Where as the procedure also i have written a new procedure which will accept the new columns as parameters and will contain a insert statement to the same log table.

 

Sep 11, 2009 at 11:37 AM
Edited Sep 11, 2009 at 11:38 AM

Please see the FormattedDatabaseTraceListener.cs class, there is a method named ExecuteAddCategoryStoredProcedure. This method executes the "AddCategory" stored procedure populating the "Category" table. Inside the "AddCategory" stored procedure it also populates the "CategoryLog" table. The thing there is, if you will create your custom database trace listener, you must have the same facility that will populate the "Category" table.

Valiant Dudan
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com