Console.WriteLine() inside a Windows Service?

The output will simply be discarded.

In a Windows Service there is no Console so Console.Write* output is
discarded. There are a number of alternatives:

  1. The System.Diagnostics.Trace class has a similar interface to the
    Console class so you could migrate your code quite easily to this.
  2. It can then be configured to output to a file. You can use the
    System.Diagnostics.EventLog class to write to the Event Log which you can then monitor using Event Viewer.
  3. You can use the third-party
    open-source log4net library which is very flexible.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)