How to stop Elmah logging?

社会主义新天地 提交于 2019-12-01 04:31:11

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.

davke

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();
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!