How to stop Elmah logging?

前端 未结 2 1163
遥遥无期
遥遥无期 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:45

    Just to note - removing from 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();
    }
    

提交回复
热议问题