Problem with the event log

G

Guest

I created a custom log by following a walkthrough. It created NewLog1. I logged several things successfully. I then tried to delete it and send my error messages to the Application log. The problem is that they still go to NewLog1 which doesn't show up in the Event Viewer because I deleted it. I have found the file NewLog1.evt and verified that the file is still receiving the error messages(they are appending) that I am trying to sending to the Application log

I have tried several times to delete NewLog1, but have been unsuccessful

I am very new to .Net. Any help would be appreciated

Rand
----------------------------------------------------------------------------
' Source cannot already exist before creating the log
If EventLog.SourceExists("Benevolence") The
EventLog.DeleteEventSource("Benevolence"
End I

'Logs and Sources are created as a pair
EventLog.CreateEventSource("Benevolence", "Application"
'Associate the EventLog component with the new log
Dim EventLog1 As EventLo
EventLog1 = New EventLo
Dim EventLogMessage As Strin
EventLog1.Log = "Application
EventLog1.Source = "Benevolence
'build message for event lo
EventLogMessage = Err.Description & vbCrLf & "Help link: " & Err.HelpFile & vbCrLf & Err.Source & vbCrLf & Err.Er

EventLog1.WriteEntry(EventLogMessage, Diagnostics.EventLogEntryType.Error, 2
 
G

Guest

I finally fixed this problem. I stopped the event log service, restarted Windows, and deleted the NewLog1 file. The file, NewLog1.evt , was always in use as long as the event log service was running. Once it was deleted and the event log restarted, my code worked just fine

Rand

----- RandyJ wrote: ----

I created a custom log by following a walkthrough. It created NewLog1. I logged several things successfully. I then tried to delete it and send my error messages to the Application log. The problem is that they still go to NewLog1 which doesn't show up in the Event Viewer because I deleted it. I have found the file NewLog1.evt and verified that the file is still receiving the error messages(they are appending) that I am trying to sending to the Application log

I have tried several times to delete NewLog1, but have been unsuccessful

I am very new to .Net. Any help would be appreciated

Rand
----------------------------------------------------------------------------
' Source cannot already exist before creating the log
If EventLog.SourceExists("Benevolence") The
EventLog.DeleteEventSource("Benevolence"
End I

'Logs and Sources are created as a pair
EventLog.CreateEventSource("Benevolence", "Application"
'Associate the EventLog component with the new log
Dim EventLog1 As EventLo
EventLog1 = New EventLo
Dim EventLogMessage As Strin
EventLog1.Log = "Application
EventLog1.Source = "Benevolence
'build message for event lo
EventLogMessage = Err.Description & vbCrLf & "Help link: " & Err.HelpFile & vbCrLf & Err.Source & vbCrLf & Err.Er

EventLog1.WriteEntry(EventLogMessage, Diagnostics.EventLogEntryType.Error, 2
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top