0

How would I go about catching an error within ELMAH when it tries to log an error to a SQL database. Currently, the SQL logging is working as expected, but what if the database is down? How would I be able to log exceptions while the database is down?

ASP.Net 2.0 using C# //yes I am working on defects for a client with a legacy application

Air
  • 8,274
  • 2
  • 53
  • 88

1 Answers1

0

I have written an answer to this problem which boils down to this:

  • write a custom error log module in order to capture the fact that no message was logged
  • write a custom tracer to enable retrieval of the exception that was thrown when the logging failed

However I would like to point out that this is not a recommended way of monitoring your sql server. You don't want to have to wait for an error before realizing that the error cannot be logged / traced. So I would recommend setting up an independent SQL Server monitor that will be your first line of defense against such a problem.

Community
  • 1
  • 1
samy
  • 14,832
  • 2
  • 54
  • 82