Handling errors in the Logging Application Block

Topics: Logging Application Block
Feb 25, 2008 at 12:39 PM

I need to do some application logging at the database level. I used the Enterprise Library Configuration Tool and it was pretty easy to add a couple of Trace Listeners like the DB Trace Listener and the Event Log Trace Listener. Everything has been working pretty cleanly and it is pretty cool how you can log to your desired Listener by using categories.

The Only problem is that if for whatever reason the ELib is unable to log to the database (e.g. the DB is down), no exception is raised. I need some way to handle such scenarios in which regardless of the Listener (or atleast the DB Listener), if I cannot Log then I need to handle such contingencies in anyway possible, whether an event is fired or an exception is raised.

Is this possible? If not then what is the point if you cannot be sure if your logging has been done properly or not?
Feb 26, 2008 at 5:21 AM
Ok I found something that if a LogEntry object fails in the Logger.Write method, the exception is forwarded to the "Logging Errors & Warnings" Special Source. This works fine for me. The only concern now that I have is that if the Listener referred in this Special Source fails, would it end up in a never ending loop?(That the Listener fails and the Application Block calls it again and it fails again and so on).