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?
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..!!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With