Avatar of jyothsna1803
jyothsna1803

asked on 

Windows service Event Log implementation

Hi,
I am using .Net 2005 to write Windows service. I would like to implement Eventlog feature. I want to create my own event Log and write events on that log. I know in .Net 2003

Usually i have written code in the constructor. But i don't see any default constructor in .net 2005. What is the best place to write this code in .net 2005.
I don't want to see any design time errors.
      public  Service1()
            {
                  this.GetConfiguration();
                  // This call is required by the Windows.Forms Component Designer.
                  InitializeComponent();
                  if (!System.Diagnostics.EventLog.SourceExists("EventSource"))
                  {        
                        System.Diagnostics.EventLog.CreateEventSource(
                              "EventSource","NewEventLog");
                  }
                  eventLog1.Source = "EventSource";
                  eventLog1.Log = "NewEventLog";


                  // TODO: Add any initialization after the InitComponent call
            }
.NET ProgrammingVisual Basic.NET

Avatar of undefined
Last Comment
Christopher Kile

8/22/2022 - Mon