G
Guest
Hi all
I have a little problem with custom v's application logs. I have the following method
private void WriteLog(string Message, EventLogEntryType EntType, string LogName
if (EventLog.SourceExists("TCSDirMonApp")
EventLog.DeleteEventSource("TCSDirMonApp")
EventLog.CreateEventSource("TCSDirMonApp",LogName);
EventLog applog = new EventLog(LogName)
applog.Source = "TCSDirMonApp"
applog.WriteEntry(Message,EntType)
applog.Close()
applog.Dispose()
applog=null
Where I write to either the 'Application' log or a custom log - in this case 'Landing'
WriteLog("Hello Application", EventLogEntryType.Error, "Application")
WriteLog("Hello Custom", EventLogEntryType.Error, "Landing")
WriteLog("Hello Application again", EventLogEntryType.Error, "Application")
WriteLog("Hello Custom again", EventLogEntryType.Error, "Landing")
My first issue is when I try to write to 'Landing' log, the system has not created the new log but has created a log named 'WinCE Log'
If I write to the application log it generally works OK, i.e. the messages always end up in the Application log, but they are also (sometimes) placed in the 'WinCE log'. I can't tie this down to an exact set of circumstances but I think it happens when I try to write to the applog after writing to the custom log. Almost as if the EventSource exists in more than one log - which i believe is impossible
Just putting the above an a windows form causes all 4 messages to be written to both Application and WinCE logs?????
Am I doing something really stupid or completely missing the point
Thanks in advance Pete.
I have a little problem with custom v's application logs. I have the following method
private void WriteLog(string Message, EventLogEntryType EntType, string LogName
if (EventLog.SourceExists("TCSDirMonApp")
EventLog.DeleteEventSource("TCSDirMonApp")
EventLog.CreateEventSource("TCSDirMonApp",LogName);
EventLog applog = new EventLog(LogName)
applog.Source = "TCSDirMonApp"
applog.WriteEntry(Message,EntType)
applog.Close()
applog.Dispose()
applog=null
Where I write to either the 'Application' log or a custom log - in this case 'Landing'
WriteLog("Hello Application", EventLogEntryType.Error, "Application")
WriteLog("Hello Custom", EventLogEntryType.Error, "Landing")
WriteLog("Hello Application again", EventLogEntryType.Error, "Application")
WriteLog("Hello Custom again", EventLogEntryType.Error, "Landing")
My first issue is when I try to write to 'Landing' log, the system has not created the new log but has created a log named 'WinCE Log'
If I write to the application log it generally works OK, i.e. the messages always end up in the Application log, but they are also (sometimes) placed in the 'WinCE log'. I can't tie this down to an exact set of circumstances but I think it happens when I try to write to the applog after writing to the custom log. Almost as if the EventSource exists in more than one log - which i believe is impossible
Just putting the above an a windows form causes all 4 messages to be written to both Application and WinCE logs?????
Am I doing something really stupid or completely missing the point
Thanks in advance Pete.