Custom Event Log RRS feed

  • Question

  • I have written a Windows Service which writes to a custom event log.  When I install the service for some reason it automatically adds my app as a source to the "Application" event log in the registry.  When I start my app I  immediately delete the source and re-create it under my custom log.  Unfortunately I have to reboot the computer for the change of source to take effect. 

    My question is, why does the installation of a service automatically add the source to the application Event log? Is there a way to suppress this step?  Is there a way to instruct the setup package to register the source to the correct log?

    If only the setup process would not add the source to the application log, then I would not have to worry about running my app once and then rebooting the machine.

    Thank You,


    Thursday, October 12, 2006 3:16 PM

All replies

  • I would also like to know the solution to this as I am having the same problem.
    Thursday, October 19, 2006 11:23 AM
  • ServiceBase (which your service derives from) provides a property called EventLog. The easiest way for you do what you want to do is to set up that EventLog property appropriately and write to that.




    public partial class MyService: ServiceBase

    public MyService()
              EventLog.Source = "MySource";
              EventLog.Log =
    "MyCustomLog"; //Default is Application


    Friday, October 20, 2006 1:18 AM