I am trying to get my .Net Windows service to go to a custom event log. I use EventLogInstaller to create an event log and source when the application is installed. I read here that it takes some time to register a source, so they recommend restarting the application before trying to write it to the log.
Since this is a Windows service, I did not need to force a restart of the computer or force the user to manually start the service, so I use this code to wait for the log to exist and the service to start automatically.
while (!(EventLog.Exists("ManageIT") || EventLog.SourceExists("ManageIT Client Service"))) { Thread.Sleep(1000); } System.ServiceProcess.ServiceController controller = new System.ServiceProcess.ServiceController("ManageIT.Client.Service"); controller.Start();
My problem is that the events from the service are still being written to the application log, and although I see my own log in the registry editor, it does not appear in the Windows 7 event viewer.
Any help would be greatly appreciated.
source share