如何停止ELMAH记录? [英] How to stop Elmah logging?

查看:146
本文介绍了如何停止ELMAH记录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Azure网站使用Elmah.MVC 2 MVC3,ASP.NET 4.5。

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

我已经将它设置为登录,通过web.config中,对Web服务器的XML文件。这一切工作。不过,我想暂时停止它,因为我相信它可能放缓的Web服务器,因为它占用的时间来写这些错误的文件。我打算登录到SQL Server。但现在我需要停止ELMAH。

I have set it up to log, via the web.config, to XML files on the webserver. This all works. However I want to stop it temporarily, as I believe it may be slowing the web server, since it is taking up time writing these error files. I plan to log to SQL Server. But for now I need to stop Elmah.

我的web.config ELMAH部分是:

My Web.config Elmah sections are :

    <sectionGroup name="elmah">
  <section name="security" requirePermission="false" type="Elmah.SecuritySectionHandler, Elmah" />
  <section name="errorLog" requirePermission="false" type="Elmah.ErrorLogSectionHandler, Elmah" />
  <section name="errorMail" requirePermission="false" type="Elmah.ErrorMailSectionHandler, Elmah" />
  <section name="errorFilter" requirePermission="false" type="Elmah.ErrorFilterSectionHandler, Elmah" />
</sectionGroup>


  

<add key="elmah.mvc.disableHandler" value="true" />
<add key="elmah.mvc.disableHandleErrorFilter" value="false" />
<add key="elmah.mvc.requiresAuthentication" value="true" />
<add key="elmah.mvc.IgnoreDefaultRoute" value="false" />
<add key="elmah.mvc.allowedRoles" value="Admin" />
<add key="elmah.mvc.allowedUsers" value="Admin" />
<add key="elmah.mvc.route" value="elmah" />

<httpModules>
  <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" />
  <add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" />
  <add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah" />
</httpModules>

<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
  <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" preCondition="managedHandler" />
  <add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" preCondition="managedHandler" />
  <add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah" preCondition="managedHandler" />
</modules>

  <elmah>
    <security allowRemoteAccess="yes" />
    <errorLog type="Elmah.SqlErrorLog, Elmah" connectionStringName="myDatabaseCS" />
    <errorLog type="Elmah.XmlFileErrorLog, Elmah" logPath="~/App_Data" />
    </elmah>
</configuration>

我想这行停止了:

I thought this line stopped it:

    <add key="elmah.mvc.disableHandler" value="true" />

但可惜不是。不过,我不能去了ELMAH页IE / ELMAH只返回我到登录页面。

But alas not. However I cannot get to the Elmah page ie /Elmah just returns me to the login page.

我怎样才能阻止ELMAH记录?

How can I stop Elmah logging?

感谢。

编辑1:

这可能是Global.asa中这个做:

it may be to do with this in Global.asa:

//filters.Add(new ElmahHandledErrorLoggerFilter());
filters.Add(new HandleErrorAttribute());

第一行注释掉,因为我不相信它是在V2必需的。所有的错误处理,现在合并ELMAH我相信。

THe first line is commented out as I do not believe it is required in V2. All error handling is now merged with Elmah I believe.

推荐答案

只需删除&LT;从&LT 元素; ELMAH&GT错误日志&GT; 部分。或评论它。再次元素回来;这将禁用日志记录功能,和所有你需要做的恢复功能,当你希望它是添加这些&LT;错误日志过夜。这样,您不必删除任何核心组件ELMAH可能导致问题以后,当你想恢复功能,特别是如果你错过的东西。

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.

这篇关于如何停止ELMAH记录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆