Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to enable and disable ELMAH in web.config and in code behind?

Tags:

elmah

I am using ELMAH for error reporting in my ASP.NET projects. Everything is working great, except when I debug a project I don't want to send an email report to the allowed users. How can I accomplish this feat?

like image 259
Sean N Avatar asked Oct 09 '09 20:10

Sean N


People also ask

Which file is used to configure error handling authentication logging?

dll file contains the HTTP Modules and Handler needed to automatically log unhandled exceptions and to display error details from a web page, these must be explicitly registered in the web application's configuration.

Where are ELMAH logs stored?

You can view the logging information in folder App_Data/Sitefinity/Logs. For more information about the Enterprise Library, see The Logging Application Block on the MSDN. ELMAH logs the following: ErrorLog.

What is Elmah io?

elmah.io is the easy error logging and uptime monitoring service for . NET. Take back control of your errors with support for all . NET web and logging frameworks. Reduce Errors Now no credit card required.


2 Answers

Assuming you have different web.config files for your development and production environments, just disable Elmah in your development web.config. You'll want to comment out (or remove) the Elmah.ErrorLogModule element in the httpModules section.

like image 73
Jim Lamb Avatar answered Sep 24 '22 03:09

Jim Lamb


Maybe you can use ErrorFiltering to turn off the email logging in the Global.asax. Something like:

void ErrorMail_Filtering(object sender, ExceptionFilterEventArgs e)
{

#if DEBUG
    e.Dismiss();
#endif

}
like image 33
Eric King Avatar answered Sep 22 '22 03:09

Eric King