Hello,
I have created a a logging mechanism, that writes mesages to a custom event
log. On each check it verifies whether the requested source is registered to
the "IPS" log. If not, it changes the registration. My problem is that
*some* messages still goto the application log, even with this code. I have
stepped through the code and verified that the logName variable actually
contains the value "IPS", but it still does not go into my own log.
I know that the docs, specify the redirecting to a different eventlog, will
not take effect until the system is restarted - i DID restart (several
times) but some log messages still end up in the application log. any
ideas??
************************************************** ****'
lock (_EventLogLockObject)
{
if (!EventLog.SourceExists(source))
{
EventLog.CreateEventSource(source, "IPS",
System.Environment.MachineName);
}
else
{
string logName = EventLog.LogNameFromSourceName(source,
System.Environment.MachineName);
if (logName != "IPS")
{
EventLog.DeleteEventSource(source);
EventLog.CreateEventSource(source, "IPS",
System.Environment.MachineName);
}
}
EventLog evLog = new EventLog("IPS", System.Environment.MachineName,
source);
evLog.WriteEntry(message, entryType);
}
************************************************** *****
-Jacob