我应该怎样登录在ASP.NET中的例外? [英] How should I log exceptions in ASP.NET?

查看:110
本文介绍了我应该怎样登录在ASP.NET中的例外?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我应该如何记录异常?我从来没有试图在.NET登录之前。也试图转储例外一个txt(或二进制)文件。我不要求一个文本文件,只是一种方式来查看的文件和行#日志。

How should I log exceptions? I never tried logging in .NET before. Nor try to dump exceptions to a txt (or binary) file. I dont require a text file, just a way to view the logs with the file and line #.

-edit-使用asp.net

-edit- using asp.net

推荐答案

ELMAH 是特别好,如果您正在使用ASP.NET。我的一个约ELMAH最喜欢的功能是不是有建立用户界面查看记录的异常; ELMAH提供了一个处理程序,将报告的异常。但是,我从来没有使用过的记录以外的任何其他异常。

ELMAH is particularly nice if you're using ASP.NET. One of my favorite features about ELMAH is not having to build the UI to view logged exceptions; ELMAH provides a handler that will report your exceptions. However, I've never used it for logging anything other than exceptions.

log4net的,并微软的EntLib 都浮现在脑海中的一些其他的想法。它们提供了比你可能需要更多的功能,如果你真正需要的仅仅是异常记录的。

log4net, and Microsoft's EntLib are some other ideas that come to mind. These provide a lot more functionality than what you may need if all you really need is just exception logging.

此外,您还可以考虑性能计数器的,如果你'我们真的试图做的是测量应用程序。同样,使用性能计数器的好处是,在公布数据之后,你会不会担心建立用户界面来查看/查询数据。

Also, you may consider performance counters if what you're really trying to do is measure your application. Again, the benefit of using performance counters is that after publishing the data, you won't have to worry about build the UI to view/query the data.

这篇关于我应该怎样登录在ASP.NET中的例外?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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