Home All Groups Group Topic Archive Search About

writing to Vista's windows application log

Author
16 Jun 2006 3:39 AM
Rob Latour
The following vb.net code works great on 2000 and XP but not on Vista:


Dim ev As New EventLog("Application", System.Environment.MachineName,
"MyProgramName")

Dim LogText As String = "Hello world"

Dim EntryType As System.Diagnostics.EventLogEntryType =
EventLogEntryType.Information

ev.WriteEntry(LogText, EntryType, LogEventID)

ev.Close()



The following excpetion is thrown on Vista:



  System.Security.SecurityException: The source was not found, but some or
all event logs could not be searched.  Inaccessible logs: Security.
   at System.Diagnostics.EventLog.FindSourceRegistration(String source,
String machineName, Boolean readOnly)
   at System.Diagnostics.EventLog.SourceExists(String source, String
machineName)
   at System.Diagnostics.EventLog.VerifyAndCreateSource(String sourceName,
String currentMachineName)
   at System.Diagnostics.EventLog.WriteEntry(String message,
EventLogEntryType type, Int32 eventID, Int16 category, Byte[] rawData)
   at System.Diagnostics.EventLog.WriteEntry(String message,
EventLogEntryType type, Int32 eventID)



Any ideas on what I am missing for Vista?

Thanks in advance, Rob

AddThis Social Bookmark Button