locked
Writing to SQL database with Microsoft.Practices.EnterpriseLibrary.ExceptionHandling RRS feed

  • Question

  • User2073826670 posted

    Until now I have been using Microsoft.Practices.EnterpriseLibrary.ExceptionHandling version 4.1 to write to the Windows event log. Now I'd like to have each error write to a database. What do I do to write the exceptions to MS SQL?

    I am looking at Microsoft.Practices.EnterpriseLibrary.Logging.Database, but I am not sure what to do with it. I have looked at the individual hands on labs but do not see how to have exception handling go anywhere o


    Thanks,

    Tuesday, November 10, 2009 10:31 AM

Answers

  • User-1951871399 posted

    You have to write your own Publisher. Create a class that implements IExceptionPublisher and then write some code in the publish method to write the exception details in your database. Finally, you will have to add your publisher in your config file (web.config) and set it to On.


    hope that helps!

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, November 10, 2009 2:10 PM