我是日誌記錄的新手。我在事件日誌中得到這個亂碼。 無法找到源(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