Possible to log when DB is down?

Topics: Logging Application Block
Nov 8, 2008 at 10:16 AM
I am using the Logger part of entlib and are saving all exceptions etc to a database. But if the database is down, is it possible to log that to a flat file instead?

I am a little bit lazy to write try catch around all mu execute-commands against the db.

Thanks in advance!
Nov 10, 2008 at 1:47 AM
If you're asking if there's a way to log to a flat file only when the database is down using the configuration file, I don't think you can do that.  But you can ensure that logs will get written to a flat file everytime, even when your database is down, by adding a FlatFile TraceListener along with your Database TraceListener. 



Sarah B. Urmeneta
Global Technology & Solutions
Avanade, Inc.
entlib.support@avanade.com

Nov 10, 2008 at 8:58 PM
Ok, thanks AvanadeSupport!

That was exactly what I was looking for unfortunaly. :( But I can of course add try-catch-blocks around every execute-command against the database and in the catch-block send the log to the flat file if it is a connection problem.

Thanks again!