I am pretty new to logging. I get this jibberish in my event log. The description for Event ID ( 0 ) in Source ( xyAMP ) cannot be found. The local computer may not have the necessary registry information or message DLL files to display messages from a remote computer. You may be able to use the /AUXSOURCE= flag to retrieve this description; see Help and Support for details. The following information is part of the event: SOURCE: System.Web
How can I make this more helpful when diagnosing errors. Here is my logging code.
Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs) Dim ctx As HttpContext = HttpContext.Current
Dim ex As Exception = ctx.Server.GetLastError()
Dim data As String = String.Empty
Dim referer As String = IIf(ctx.Request.ServerVariables("HTTP_REFERER") IsNot Nothing, ctx.Request.ServerVariables("HTTP_REFERER").ToString(), String.Empty)
Dim sForm As String = IIf(ctx.Request.Form IsNot Nothing, ctx.Request.Form.ToString(), String.Empty)
Dim sQuery As String = IIf(ctx.Request.QueryString IsNot Nothing, ctx.Request.QueryString.ToString(), String.Empty)
data = "SOURCE: " + ex.Source + vbCrLf
data += "MESSAGE: " + ex.Message + vbCrLf
data += "FORM: " + sForm + vbCrLf
data += "QUERYSTRING: " + sQuery + vbCrLf
data += "TARGETSITE: " + ex.TargetSite.ToString() + vbCrLf
data += "STACKTRACE: " + ex.StackTrace + vbCrLf
data += "REFERRER: " + referer
Dim eventLogName As String = "xyAMPLog"
Dim sourceName As String = "xyAMP"
Dim xyAMPLog As New EventLog()
xyAMPLog.Log = eventLogName
xyAMPLog.Source = sourceName
Try
xyAMPLog.WriteEntry(data, EventLogEntryType.Error)
Catch exc As Exception
Console.WriteLine(exc.Message)
End Try
'ctx.Server.ClearError()
End Sub
Any suggestions to clean this up?
Thanks, ~ck in San Diego