D
DC Gringo
I have some code that writes log entries upon errors in an VB.NET web app.
I can write the Message but in the log, preceding my message is the
following:
Description:
The description for Event ID ( 0 ) in Source ( Application ) 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: <MY
MESSAGE SHOWS UP HERE>
How can I get rid of this and/or add the Event ID as suggested? Here's my
code
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim MissingPageErrorMsg As String
MissingPageErrorMsg = "A user has attempted to visit a non-existent page:
" & Request.QueryString("aspxerrorpath")
WriteToEventLog("Application", MissingPageErrorMsg)
End Sub
Sub WriteToEventLog(ByVal LogName As String, ByVal Message As String)
'Create event log if it doesn't exist
If (Not EventLog.SourceExists("Application")) Then
EventLog.CreateEventSource("Application", "Application")
End If
' Write to application event log
Dim Log As New EventLog("Application")
Log.Source = LogName
Log.WriteEntry(Message, EventLogEntryType.Error)
End Sub
I can write the Message but in the log, preceding my message is the
following:
Description:
The description for Event ID ( 0 ) in Source ( Application ) 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: <MY
MESSAGE SHOWS UP HERE>
How can I get rid of this and/or add the Event ID as suggested? Here's my
code
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim MissingPageErrorMsg As String
MissingPageErrorMsg = "A user has attempted to visit a non-existent page:
" & Request.QueryString("aspxerrorpath")
WriteToEventLog("Application", MissingPageErrorMsg)
End Sub
Sub WriteToEventLog(ByVal LogName As String, ByVal Message As String)
'Create event log if it doesn't exist
If (Not EventLog.SourceExists("Application")) Then
EventLog.CreateEventSource("Application", "Application")
End If
' Write to application event log
Dim Log As New EventLog("Application")
Log.Source = LogName
Log.WriteEntry(Message, EventLogEntryType.Error)
End Sub