我是日志记录的新手。我在事件日志中得到这个乱码。 无法找到源(xyAMP)中事件ID(0)的说明。本地计算机可能没有必要的注册表信息或消息DLL文件来显示来自远程计算机的消息。您可以使用/ AUXSOURCE =标志来检索此说明;详细信息请参阅帮助和支持。以下信息是事件的一部分:消息来源:System.Web如何在事件日志中获得更具描述性的错误消息?
如何在诊断错误时使这更有用。 这是我的日志代码。
子的Application_Error(BYVAL发件人为对象,BYVALË作为EventArgs的) 昏暗CTX作为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
清理它任何建议?
感谢,在圣地亚哥 〜CK
这与MC有什么关系? – 2010-01-11 03:04:16