ASP.NET Health Monitoring or ELMAH what to choose?
net 4 in C# with SQL Server 2008 R2.
I need to choose an error logging solution for my Web Application.
I read some article ELMAH and ASP.NET Health Monitoring on the topic but I would like have your opinion and thoughts on which system you prefers in your a real world application and why.
Some point in which 开发者_开发问答I'm interested:
- setup and configuration
- error reports
- performance
ASP.NET Health Monitoring is not a logging solution. According to ASP.NET Health Monitoring overview:
ASP.NET health monitoring enables you to do the following tasks:
- Monitor the performance of an application to make sure that it is healthy.
- Rapidly diagnose applications or systems that are failing.
- Appraise significant events during the life cycle of an application.
- Monitor live ASP.NET applications, individually or across a Web farm.
- Log events that do not necessarily relate to errors in an ASP.NET application.
The level of required configuration depends on what you need to accomplish. For several of my applications, all we need is:
<healthMonitoring enabled="true">
<rules>
<add name="Application Lifetime Events On" eventName="Application Lifetime Events"
provider="EventLogProvider" profile="Default"/>
</rules>
</healthMonitoring>
This enables health monitoring and adds application lifetime events to those events collected by default. This way, we know when an application starts and stops, and why.
Note that we didn't have to touch any code to get this functionality.
I found set up and integration with ELMAH very very easy to do. If you use NuGet to install ELMAH, It would be a piece of cake like Scott Hanselman shows in this video.
You just need to do following on your package manager and thats it:-
install-package elmah
It's a matter of opinion (and requirements), but I'd choose ELMAH because it offers everything MS Health Monitoring offers, and then some. The biggest feature for me is the built in error viewer from ELMAH.
I started using ELMAH ever since Scott Hanselman said it was the greatest thing since sliced bread, and I really do like it. As Esteban stated above, it monitors much more than MS Health Monitor, and is much more configurable.
You could also use come combination of log4Net or the Enterprise Library logging and Exception blocks, along with enabling HTTP errors in the registry, but really, why re-invent the wheel?
精彩评论