Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where does Console.Out.Write() go for a windows service?

I have added various Console.Out.Write() statements for debugging purposes in a Windows service application, which I run as a console app when testing. Is there any harm in leaving these statements when deploying the application as a service? (the debugging information is not sensitive, I don't care if users happen to find and see it)

Also, is there a way to view the console output of a particular service while it is running?

like image 202
invertigo Avatar asked Nov 03 '22 20:11

invertigo


1 Answers

Is there any harm in leaving these statements when deploying the application as a service?

It will not show you any Exception, if you are printing it on Console. This way you will be in complete darkness about errors and exceptions.

Is there a way to view the console output of a particular service while it is running?

Yes, surely. You can view the output in the Output Window after you print it using Debug.Print() or Debug.WriteLine().

They both do the same thing, but Debug.Print() will only take a string, while Debug.WriteLine() will accept an object which ends up calling the object's ToString() method.

IMHO, you should either use some kind of logging instead of printing all these. You can see logs anytime, but you will not be able to seat and see Console output all the time..!!

like image 145
Bhushan Firake Avatar answered Nov 10 '22 19:11

Bhushan Firake