1

Hi I have a database trace listener and I would like to log the stack trace on the database when I get an error. I can add the stack trace to the message pretty easily but I would prefer to add it to another column in the database table. How would I achieve this?

David
  • 5,403
  • 15
  • 42
  • 72

1 Answers1

2

You can find a sample solution called Custom Database Trace Listener Sample at Enterprise Library Sample Projects.

The basic steps are to create a custom LogEntry class with a custom property. An additional column is added to the [Log] table and the out of the box stored procedure is modified to accept a new parameter. Then a custom Trace Listener passes the custom property data to the stored procedure where it is inserted into the database.

Randy Levy
  • 22,566
  • 4
  • 68
  • 94