Join 34,000+ subscribers and receive articles from our
blog about software quality, testing, QA and security.

Log file not being generated



I have a 3.5 windows service running on windows server 2008. If i run it from my development machine, the log files are being created. However once its up and running on the server, no logs are being generated. Is there a specific permision i need to enable on the server? Do i need to set/remove a setting from the config file?

The config file looks like this:

AppName = MyService
Connections = file(append=“true”, filename=“trace.sil”, maxparts=“7”, rotate=“daily”), text(append=“true”, filename=“trace.log”, maxparts=“7”, rotate=“daily”, pattern="%timestamp% - %level,-7% - %title%", indent=“true”), pipe(reconnect=“true”, reconnect.interval=“1”)
Enabled = True

The code to load the config file looks like this:

SiAuto.Si.LoadConfiguration(System.AppDomain.CurrentDomain.BaseDirectory + “config.sic”);
SiAuto.Si.Enabled = true;

Any help would be greatly appreciated

Many Thanks



Hello Lee,

This is probably indeed a permission problem. Your configuration file looks file. It may be that when you don’t run the service on your development machine, that the service/user doesn’t have the required permissions to open/write the log file.

You can check for such errors by registering an event handler to the SmartInspect Error event as explained in the SmartInspect manual (press F1 in the Console, then go Working with SmartInspect | Library Error Handling).

It basically works as follows:

[code]public class ErrorHandling
public static void EventHandler(object sender, ErrorEventArgs args)

public static void Main(string[] args)
// Register our event handler for the error event.
SiAuto.Si.Error += new ErrorEventHandler(EventHandler);

  // And force a connection error
  SiAuto.Si.Connections = @"file(filename=c:\)";
  SiAuto.Si.Enabled = true;


It is not recommended to use SmartInspect in the error event, so it’s best to log an error with a third-party logging mechanism. In the example, I simply write the message with System.Console, but in a service you could use the Windows event log (with the System.Diagnostics.EventLog class). This should help you find the issue/permission problem. Please let me know in case you have any further questions.



Thanks Tobias,

I will give it ago and see what error is retrieved. Will let you know.