user1372448
user1372448

Reputation: 437

log file path for windows service

I have a Windows service which does some work and in which I am also trying to write the logs to a file. Inside my app.Config, I have a section to define the source of the log file:

In the Serivce1.cs, I have define the logger as:

  public partial class Service1 : ServiceBase
    {
        private static TraceSource ServiceLogger = new TraceSource("ServiceTrace");

Inside other methods, I write to the log file by the following code,

ServiceLogger.TraceEvent(TraceEventType.Information, 1, "{0} : Running", DateTime.Now);

There is not an exception inside the windows event viewer and the service is running with local system (broad previliges) but I am not able to find the log after the installation of this service. Any suggestions?

Upvotes: 0

Views: 3303

Answers (1)

JSJ
JSJ

Reputation: 5691

here is a sample demo for you.

http://msdn.microsoft.com/en-us/library/ms751526.aspx

Configurations

http://msdn.microsoft.com/en-us/library/ms733025.aspx

Upvotes: 1

Related Questions