Why won't my windows service write to my log file?

I've had this issue too. As mentioned by genki you are probably logging into the \Windows\System32 directory. Maybe check for the log file you are expecting there first. When writing services I've often put a line like this in the beginning to get the current directory to behave like a normal application

Directory.SetCurrentDirectory(AppDomain.CurrentDomain.BaseDirectory);

Your local service account doesn't have access to write to the file location specified. You set it to use a system account in the "Log On" tab of the service properties dialog, or you can set up the user account as part of the setup process.


If you are using x64 version of Windows than the log file is saved in C:\Windows\SysWOW64 folder

This is the default case if you build your project using the AnyCPU configuration and deploy to a 64 bit operating system.