views:

124

answers:

1

Hi

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.

+1  A: 

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.

John Saunders