Sample Logging app with db

Topics: Logging Application Block
Jul 30, 2009 at 11:59 PM

I've used the Data Access App Block for years, but I am trying to get started with some of the other blocks for a new project. What I would really like for the Logging Application Block is a very small sample application that writes the log to a database. Something like, push button, throws an exception which is then written to the database. Does anything like that exist? I'm just a little stuck getting going. Thanks.




Jul 31, 2009 at 2:57 AM

Yes, there is.  If you installed the entlib source code, you can find a script file(LoggingDatabase.sql) for creating the Logging database located in EntLib41Src\Blocks\Logging\Src\DatabaseTraceListener\Scripts.  In order to utilize that database, you can add a Formatted Database TraceListener in your config and configure the DatabaseInstance property by selecting a connection string you created in the DAAB section.  You can refer to the documentation for the other necessary properties to set but if you didn't change any of the names of stored procedures in the database, the default properties of the database tracelistener are already the correct ones. 


Sarah Urmeneta
Global Technology and Solutions
Avanade, Inc.