I've been messing with this all day and have still not found a solution. I have created a windows service that is supposed to log to it's install directory (Program Files/Service/LOGS/
)
But when I run my service it doesn't do what I would expect it to do and it doesn't log anythying. I'm having a hell of a time figuring out what the problem is without any sort of logging. Below is the class I am using for logging, can anyone see what I am doing wrong? I have even tried giving "Everyone" all permissions on the LOGS folder to see if that was the issue (but no luck).
public class Logging
{
public static void Log(string message)
{
string logFile = "LOGS/" + DateTime.Now.ToString("yyyyMMdd") + ".txt";
if (!Directory.Exists("LOGS"))
{
Directory.CreateDirectory("LOGS");
}
File.AppendAllText(logFile, message);
}
}
The service successfully starts and there are no errors in my Windows Event Viewer...
UPDATE:
I have changed my log path to the following and am still having no luck:
string logFile = @"F:\LOGS\" + DateTime.Now.ToString("yyyyMMdd") + ".txt";