Not able to Log to Database using Database Trace Listener

Topics: Logging Application Block
Oct 11, 2011 at 6:23 PM
Edited Oct 11, 2011 at 6:24 PM

Can anyone tell me how to do database Logging using Database Trace Listener. I already have a rolling flat file listener and its working fine. Now I want the same logging functionality to be implemented in a Database.

From what I have found over the web is that the Database file (.mdf) has to given as the input in the config file. But if I have my database server over a different location(i.e there is no access to .mdf), how am I to do the database logging?. Is there any way to specify just the server name, database name and procedure name and not the .mdf file and still do the database logging?.

Please reply with the necessary code block.

Oct 24, 2011 at 2:40 AM

I recommend looking at the Hands-On Labs for Microsoft Enterprise Library 5.0.

Obviously to log to a database you will need access to the database (whether it's local or remote).  Enterprise Library uses the .NET connectionStrings configuration
to determine the database connection information. 

Randy Levy
Enterprise Library support engineer