T
tshad
I am trying change the log that my application writes to from Application to
a new log. But since I already have started writing to the Application
log - I get the error:
The source 'Repos' is not registered in log 'Repos'. (It is registered in
log 'Application'.) " The Source and Log properties must be matched, or you
may set Log to the empty string, and it will automatically be matched to the
Source
My code is doing:
string source;
string log;
string eventMessage;
string machine;
source = "Repos";
log = "Repos";
eventMessage = message;
machine = ".";
if (!EventLog.SourceExists(source, machine))
EventLog.CreateEventSource(source, log, machine);
EventLog eLog = new EventLog(log, machine, source);
eLog.WriteEntry(eventMessage, eventType);
I should be able to fix it by removing the source by:
EventLog.DeleteEventSource("Repos")
But how to I determine what log the source is registered to?
I can tell if the Source exists, but how do I tell what it is registered to?
Thanks,
Tom
a new log. But since I already have started writing to the Application
log - I get the error:
The source 'Repos' is not registered in log 'Repos'. (It is registered in
log 'Application'.) " The Source and Log properties must be matched, or you
may set Log to the empty string, and it will automatically be matched to the
Source
My code is doing:
string source;
string log;
string eventMessage;
string machine;
source = "Repos";
log = "Repos";
eventMessage = message;
machine = ".";
if (!EventLog.SourceExists(source, machine))
EventLog.CreateEventSource(source, log, machine);
EventLog eLog = new EventLog(log, machine, source);
eLog.WriteEntry(eventMessage, eventType);
I should be able to fix it by removing the source by:
EventLog.DeleteEventSource("Repos")
But how to I determine what log the source is registered to?
I can tell if the Source exists, but how do I tell what it is registered to?
Thanks,
Tom