Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make my service stop auto-posting into windows application event log

I just created a Windows service application in Visual Studio using the Windows Service project template. When I install and run the service, I notice that it automatically logs certain events to the Windows application event log. For example:

Service started successfully.

or

PowerEvent handled successfully by the service.

I plan to implement my own event logging with more detail, so these auto-generated messages will end up being extra "noise" that I don't want cluttering the log. Is there any way to prevent the service from writing the default messages into the event log?

like image 326
ahmd0 Avatar asked Feb 16 '23 22:02

ahmd0


1 Answers

Use the autolog property for the service:

this.AutoLog = false;

More information here: http://msdn.microsoft.com/en-us/library/f6567h1s.aspx

like image 151
Vaibhav Desai Avatar answered Feb 20 '23 04:02

Vaibhav Desai