Anybody knows how to implement database exception logging using EL 5.0?
Thanks!
Anybody knows how to implement database exception logging using EL 5.0?
Thanks!
You will need to run a script against the database so that it creates a specific table structure for you. Also, there will be a stored procedure that will be created that you will have to reference in the Trace Listener's configuration section. You should be able to find this script file here: C:\EntLib41Src\Blocks\Logging\Src\DatabaseTraceListener\Scripts folder. I know this is for version 4 of the library, but looking into the version 5, I realized that the folder structure has taken a change and the script folder is no where in sight. However, this site here should provide you with some guidance.
You may also try MSDN Documentation
So I did a little bit more investigation into the mysterious disappearance of the EntLib50Src\Blocks\Logging\Src\DatabaseTraceListener\Scripts folder. What it turn out to be is that if you had install the Entlib5 to your computer using the MSI like I did. There is actually a Source Code MSI that you can run, buried deep in the C:\Program Files (x86)\Microsoft Enterprise Library 5.0\src if you're using a 64bit pc or C:\Program Files\Microsoft Enterprise Library 5.0\src if you're not. Run this MSI and it will install the the source codes for Entlib5 and also the missing Scripts folder.
Have you walked through the hands on tutorial? They have a section dedicated to each feature of the enterprise library, including exception logging. http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=6932
Step one: configure the logging block to log to the database. There's a lab for that. Step two: Configure the exception block to log exceptions. There's a lab for that. Step three: Point the exception block at the logging category that writes to the database.
That's it. There's nothing special about logging exceptions to the database. The exception block will write to the logging block. The logging block treats these just like it would any other logging operation. Follow the instructions for setting up database logging and you're basically done.