We have a C# service that is deployed to a remote customer system. The application writes a substantial amount of \"diagnostic\" information to the console (i.e. Console.WriteL
You've got a bunch of options; redirecting console output to a file and using a proper logging library as mentioned are two good ones. Here's a middle option: write to the event log.
EventLog log;
string logsource = "MyService";
// execute once per invocation
if (!System.Diagnostics.EventLog.SourceExists(logsource))
{
System.Diagnostics.EventLog.CreateEventSource(
logsource, "Application");
}
log = new EventLog();
log.Source = logsource;
log.Log = "Application";
// replace console logging with this
log.WriteEntry(message, EventLogEntryType.Information);
Then look for entries in the Application event log (Administrative Tools -> Event Viewer) where Source = "MyService".