How to stop Elmah logging?

前端 未结 2 1139
遥遥无期
遥遥无期 2021-01-05 16:25

I am using Elmah.MVC 2 with MVC3, ASP.NET 4.5 on Azure Websites.

I have set it up to log, via the web.config, to XML files on the webserver. This all works. However

相关标签:
2条回答
  • 2021-01-05 16:38

    Just remove the <errorLog> elements from your <elmah> section. Or comment it out. This will disable the logging functionality, and all you have to do to restore functionality when you want it is add those <errorLog> elements back in again. This way, you don't have to remove any of the core Elmah components that could lead to problems later on when you want to restore functionality, particularly if you miss something.

    0 讨论(0)
  • 2021-01-05 16:45

    Just to note - removing <errorLog> from <elmah> in web.config does not stop the logging, it just reverts it to in-memory logging as described in this SO answer. (cannot comment on the accepted answer due to insufficient rep.)

    If the intent is to stop logging entirely, you can use the Elmah's ErrorFilterModule (assuming that it is added in web.config) for that, like so (global.asax.cs excerpt):

    protected void ErrorMail_Filtering(object sender, ExceptionFilterEventArgs e)
    {
        e.Dismiss();
    }
    
    0 讨论(0)
提交回复
热议问题