I am creating an custom eventlog using the code below.
The eventlog and source will be created fine but something strange happens when I write to the log:
This customlog and the Application log keep track of the same entries! So whenever I write an entry to my custom log it will also show up in the application log. And, whenever any application logs to the application log, it will also show up in my custom log.
I have never seen this before. I used this piece of code many times but always on a Windows XP development machine.
Now I am developing on a Windows Server 2003 machine...
Does anybody know how to solve this issue so that the logs are not interconnected anymore?
string sourceName = "MyService v2.1";
string logName = "MyService";
EventSourceCreationData data = new EventSourceCreationData(sourceName, logName);
EventLog logs = EventLog.GetEventLogs();
if (logs != null)
foreach (EventLog log in logs)
if (log.Log == logName)
if (log.OverflowAction != OverflowAction.OverwriteAsNeeded)
this._eLog = log;
this._eLog.Source = sourceName;