Entlib ... logging exceptions to database

Mar 25, 2008 at 8:41 PM
dears ,
I need an example to show the case of how to use the exception , logging and DB blocks to log an exception in a datatbase ...
how the fields of the exception be logged in the database ...
what is the steps required to do so ..

any help of any kind is really appreciated
Mar 26, 2008 at 4:45 PM
There is a database script that comes with the download. You control the DB Name etc in your configuration of your listener.


<add databaseInstanceName="LOGGINGDB" writeLogStoredProcName="WriteLog"
addCategoryStoredProcName="AddCategory" formatter="Text Formatter"
listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Database.Configuration.FormattedDatabaseTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging.Database, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
traceOutputOptions="None" type="Microsoft.Practices.EnterpriseLibrary.Logging.Database.FormattedDatabaseTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging.Database, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
name="Database" />


EL Library is set to call the specified stored proc, you could change the fields underneath in the stored proc or just use it out of the box.