event log not visible for window service

Posted by Sahoo under C# on 2/27/2012 | Points: 10 | Views : 1181 | Status : [Member] | Replies : 4
I am unable to see event log in WINDOW7 professional for my window service.
My code is:

private const string sourceName = "SampleWindowService";
protected override void OnStart(string[] args)
{
try
{
//log to track activity of window service
if (!System.Diagnostics.EventLog.SourceExists(sourceName))
{
System.Diagnostics.EventLog.CreateEventSource(sourceName, "DemoService");
}

this.EventLog.Source = sourceName;
this.EventLog.Log = "DemoService";
this.EventLog.WriteEntry("Service started successfully");

time.Start();
time.Enabled = true;
time.Interval = 60000;
time.Elapsed += new ElapsedEventHandler(OnElapsedTime);
}
catch (Exception ex)
{
// ExceptionLogger.LogException(ex);
}
}



Service is running.But event log is not visible.
Can any one give me steps to view it.


thank in advance




Responses

Posted by: Hmanjarawala on: 2/27/2012 [Member] Bronze | Points: 25

Up
0
Down
Hey, Have you found your service in Windows Services..??
or have you developed Service Installer???

Himanshu Manjarawala
Sr. Software Engineer@AutomationAnywhere
http://fieredotnet.wordpress.com/

Sahoo, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sahoo on: 2/27/2012 [Member] Starter | Points: 25

Up
0
Down
thanks 4 replay

ya ,my Windows Services is there .Service is running.But I am not able to locate event log.


Sahoo, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Hmanjarawala on: 2/27/2012 [Member] Bronze | Points: 25

Up
0
Down
Ok....just go in Control Panel -> Administrative Tools -> Event Viewer

Himanshu Manjarawala
Sr. Software Engineer@AutomationAnywhere
http://fieredotnet.wordpress.com/

Sahoo, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sahoo on: 2/29/2012 [Member] Starter | Points: 25

Up
0
Down
Still it is not visible.Service is running but event log is not getting created .

Sahoo, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response