如何在ASP.NET应用程序中记录错误(异常)? [英] How do you log errors (Exceptions) in your ASP.NET apps?

查看:208
本文介绍了如何在ASP.NET应用程序中记录错误(异常)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找在ASP.NET应用程序中记录错误的最佳方式。
我希望能够在我的应用程序中发生错误时收到电子邮件,并提供有关异常和当前请求的详细信息。



在我公司,我们使用拥有自己的ErrorMailer,捕获Global.asax Application_Error中的所有内容。这是Ok,但不是非常灵活或不可配置。



我们最近切换到NLog。它更可配置,我们可以为错误定义不同的目标,过滤它们,缓冲它们(尚未尝试)。这是一个非常好的改进。



但是我最近发现在.Net框架中有一个完整的命名空间用于此目的: System.Web.Management ,它可以在 healthMonitoring 部分的web.config。


$ b $你曾经与.Net健康监控工作吗?

解决方案

我使用 elmah 。它有一些非常好的功能,这里是一个 CodeProject 文章。我认为StackOverflow团队也使用elmah!


I'm looking for the best way to log errors in an ASP.NET application. I want to be able to receive emails when errors occurs in my application, with detailed information about the Exception and the current Request.

In my company we used to have our own ErrorMailer, catching everything in the Global.asax Application_Error. It was "Ok" but not very flexible nor configurable.

We switched recently to NLog. It's much more configurable, we can define different targets for the errors, filter them, buffer them (not tried yet). It's a very good improvement.

But I discovered lately that there's a whole Namespace in the .Net framework for this purpose : System.Web.Management and it can be configured in the healthMonitoring section of web.config.

Have you ever worked with .Net health monitoring? What is your solution for error logging?

解决方案

I use elmah. It has some really nice features and here is a CodeProject article on it. I think the StackOverflow team uses elmah also!

这篇关于如何在ASP.NET应用程序中记录错误(异常)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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