Reputation: 181
I have set Elmah for an ASP.NET MVC 5 project to handle exceptions and save them in database (Oracle).
Now I've encountered a situation where Elmah can fail to log exceptions in database and cause an exception by itself because database being down, connection string changes etc.
I tried this:
try
{
Elmah.ErrorSignal.FromCurrentContext().Raise(new Exception("Testing Elmah exception handling"));
} catch (Exception ex)
{
LogException(ex);
}
but LogException(ex) is never executed.
In LogException I have implemented a custom logger that also writes in database.
Upvotes: 2
Views: 283
Reputation: 6783
Elmah writes failures in Windows Event logs on server in fallback scenarios. That means, if Elmah fails to write exception/ event in the configuration option you might have selected (i.e., Database, file system, or whatever custom option configuration), it will write to the Windows Event Logs on the server where the application is running.
As an additional note, in case of NLB (Load balance) environments, the exception would be logged in Windows event log of one of the servers from where a particular request is being served, and not all server where the application is running).
Upvotes: 1