Write log description

From: DC Gringo (dcgringo_at_visiontechnology.net)
Date: 05/14/04


Date: Fri, 14 May 2004 15:56:35 -0400

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

-- 
_____
DC G


Relevant Pages

  • Re: "No such interface supported" for Event Sink
    ... The way your sending the message in the Sub isn't going be using Exoledb. ... > Sub SendNewMessage(varFrom As String, varTo As String, varSubj As String, ... >> relating to Exoledb in the event log. ...
    (microsoft.public.exchange2000.development)
  • Project Error
    ... Private Declare Sub Sleep Lib "Kernel32" ... Dim strDataSrc As String ...
    (microsoft.public.vb.bugs)
  • RE: jpgs not showing on forms
    ... Rather than embed the pictures in the database store the paths to the JPEG ... Private Sub cmdAddImage_Click ... Dim strAdditionalTypes As String, strFileList As String ... Private Sub cmdDeleteImage_Click ...
    (microsoft.public.access.gettingstarted)
  • Re: FTP CD command
    ... My code connects to a ftp site and the enumerates all content on that place ... Public Property UriAs String ... End Sub ... Dim listRequest As FtpWebRequest = CType, ...
    (microsoft.public.dotnet.languages.vb)
  • Re: FTP CD command
    ... Private _Uri As String ... End Sub ... Dim listRequest As FtpWebRequest = CType, ... Public Sub UploadAsynch(ByVal fileName As String, ByVal uploadUrl As ...
    (microsoft.public.dotnet.languages.vb)