Frage

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?

War es hilfreich?

Lösung

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.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top