How to use CustomTraceListener?

Topics: Logging Application Block
Jun 29, 2009 at 10:48 AM


I want to extend FormattedDatabaseTraceListener for logging exceptions into databse. I want to add more columns in Log table.

I have tried modifying the code in FormattedDatabaseTraceListener.cs file and have refered the logging.database.dll in my project but it's throwing compile error for referenced assemblies.

Please guide me on how to extend enterprise library code and use it in project.

And if this require CustomTraceListener; then how to work on it?

Jun 29, 2009 at 10:52 AM

If you want to extend the entlib code, you need to create a custom tracelistener and make it behave like a FormattedDatabaseTraceListener.  This blog might be exactly what you're looking for.


Sarah Urmeneta
Global Technology & Solutions
Avanade, Inc.

Jun 30, 2009 at 1:19 PM

thanks for the reply.

I am using unsigned dll in my project. I am getting following error in event log :

Tracing to LogSource "CustomCategory" failed.

 in CustomCategory I am refering to Email Tracelistener and Database Tracelistener resp. I am getting exception details through mail but not logging to databse. What I am doing wrong here?


Jun 30, 2009 at 2:29 PM

I just have to refresh the referred assemblies and my problem is solved now,

Thank you.