使用 Global.aspx 页进行错误报告

发布于 2024-07-16 10:38:21 字数 727 浏览 7 评论 0原文

我一直无法从收到的错误报告中识别应用程序中的错误。 目前,我建立了一封电子邮件,其中包含有关错误的信息。

  • 用户
  • 网址
  • 错误消息
  • 时间和日期

这是我使用的代码

Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)

    Dim _UserIpAddress as string = Request.ServerVariables("REMOTE_ADDR")
    Dim _Browser as string = Request.ServerVariables("HTTP_USER_AGENT")
    Dim _URL as string = Request.Url.AbsoluteUri
    Dim _ErrorDate as string = System.DateTime.Now
    Dim _Error as string = Server.GetLastError().InnerException.ToString()

End Sub

问题是在某些情况下使用此信息我无法找出导致错误的原因。

我如何获得有关错误的更多详细信息? 例如,是什么控制导致了它,系统中传递的变量中的数据

以及您使用了除电子邮件之外的哪些收集数据的方法以及它们的成功程度。 例如登录数据库、在文本文件中重新编码等。

I have always had issues with identifying the errors in applications from the error reports I get. Currently I build an email with information about the error containing.

  • User
  • Url
  • Error Message
  • Time And Date

This is the code I use

Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)

    Dim _UserIpAddress as string = Request.ServerVariables("REMOTE_ADDR")
    Dim _Browser as string = Request.ServerVariables("HTTP_USER_AGENT")
    Dim _URL as string = Request.Url.AbsoluteUri
    Dim _ErrorDate as string = System.DateTime.Now
    Dim _Error as string = Server.GetLastError().InnerException.ToString()

End Sub

The issue is that with this information in some cases I cant work out what has caused the error.

How would I get some more detail on the error? e.g what control caused it, the data in the variables being passed in the system

Also what methods of collecting the data other than email have you used and how successful have they been. e.g. logging in a database, recoding in a text file etc.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

原来分手还会想你 2024-07-23 10:38:21

例如,没有通用的方法来捕获所涉及的变量。 您几乎要求在出现错误时进行转储! 即便如此,您也必须弄清楚用户在错误发生之前做了什么。 您可以从 IIS 日志中获取一些帮助(如果引用 URL 不为空,您还应该记录它)。

这个问题的真正答案是一个难题:更好的质量保证。 上线后发生的错误越少,您需要解决的错误就越少。

通过自动化单元测试(尤其是使用测试驱动开发)发现错误,可以进一步减少 QA 中发现的错误数量。

There's no general method of capturing the variables involved, for instance. You're pretty much asking that a dump be taken whenever you get an error! Even so, you'd have to figure out what the user had been doing before the error occurred. You can get some help from the IIS logs (and you should also log the Referrer URL if it's non-null).

The true answer to this problem is a hard one: better QA. The fewer errors that happen once you've gone live, the fewer you'll have to figure out.

The number of errors found in QA can be further reduced by finding them through automated unit testing, especially using Test-Driven Develpopment.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文