ASP.NET - 错误引发或记录 [英] ASP.NET – Error throwing or logging

查看:105
本文介绍了ASP.NET - 错误引发或记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在C#中构建ASP.NET应用程序

We are building an ASP.NET application in C#

我们有3层:用户界面,业务和数据库。我们需要对错误处理/记录澄清。我们有一个错误日志框架记录错误。

We have 3 layers: UI, Business and Database. We need clarification on error handling/logging. We have a error logging framework to log errors.

我的问题是:我们需要在每一层中记录错误或仅在从业务和数据库层抛出错误UI层的主要调用层(UI层)? 是否有最好的做法?

My question is: do we need to log errors in each layer or only in the main calling layer (UI layer) by throwing the errors to UI layer from business and database layers? Is there a best practice?

如果将是巨大的,如果你还可以提供一个参考文件或网页的引用(如果需要)。

If would be great if you could also provide a reference document or web references (If needed).

感谢和问候......
Sruthi Keerthi。

Thanks and Regards … Sruthi Keerthi.

推荐答案


  • 手柄,你可以在该层,他们发生的任何异常。让你不能处理泡沫到UI层的人。看到
    对于ASP.NET Web应用程序异常处理建议了解更多信息。

  • 使用异常记录机制如 ELMAH 在UI记录异常。

  • Handle any exceptions that you can in the layer that they occur. Let the ones that you can't handle bubble up to the UI layer. See Exception Handling Advice for ASP.NET Web Applications for more information.
  • Use an exception logging mechanism like Elmah to log exceptions in the UI.
  • 这篇关于ASP.NET - 错误引发或记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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