8

我打算将 ELMAH 用于我们的终极自动错误日志记录,但最近意识到 ASP.NET 健康监控也可以做同样的工作(也许)。现在我想知道(请)它们是否是彼此的替代品,就像 log4net 和 entlib 一样?

4

3 回答 3

7

ELMAH 用于错误监控,纯粹而简单。通过读数、RSS 提要等轻松查看错误。健康监控更像是一个完整的仪器解决方案。

想要简单的答案?

ELMAH 是一种用于错误监控的非常快速的可插拔解决方案,它有一个非常具体的任务(做得很好)。健康监控更像是散弹枪查看/监控一切的方法,涉及更多的设置工作。哦对了,需要改吗?它是开源的,抓住它,随心所欲地改变它。

于 2010-02-21T05:29:38.840 回答
1

ASP.NET Health Monitoring will automatically generate messages for events like app domain startup and shutdown and heartbeats and many other information about the web application. Logging frameworks don't support such features, but you can route the Health Monitoring system events to your logging framework of choice. Some frameworks even support this out of the box, such as CuttingEdge.Logging. Here is an configuration example of a CuttingEdge.Logging where the health events are forwarded to a logging provider:

<?xml version="1.0"?>
<configuration>
  <configSections>
    <section name="logging"
      type="CuttingEdge.Logging.LoggingSection, CuttingEdge.Logging" />
  </configSections>
  <system.web>
    <healthMonitoring heartbeatInterval="0" enabled="true">
      <providers>
        <!-- We're configuring the web event provider here. -->
        <add name="LoggingWebEventProvider"
  type="CuttingEdge.Logging.Web.LoggingWebEventProvider, CuttingEdge.Logging"
          loggingProvider="DebugLogger" />
      </providers>
      <rules>
        <add name="Custom Event Provider"
           eventName="All Events"
           provider="LoggingWebEventProvider"
           profile="Default" />
      </rules>
    </healthMonitoring>
  </system.web>
  <logging defaultProvider="DebugLogger">
    <providers>
      <!-- Configure your favorite provider here. -->
      <add name="DebugLogger"
        type="CuttingEdge.Logging.DebugLoggingProvider, CuttingEdge.Logging"
        description="Debug logging provider"
        threshold="Debug" />
    </providers>
  </logging>
</configuration>
于 2010-02-22T10:09:43.993 回答
1

我没有在 ASP.NET 中使用过健康监控,但我使用过 ELMAH,这简直太棒了。从字面上看,设置只需 2 分钟,然后您就可以看到所有错误。还有很多选项可以显示错误。试试 ELMAH,你会爱上它的。

于 2010-02-21T05:18:06.150 回答