NLog does not write to file on Vista deployment
-
12-09-2019 - |
Question
I am using NLog for the first time on a project. I want to log to a file, so I added a target writing to fileName="${basedir}/logs/${shortdate}.log". This creates/appends log info to a file in MyApplicationFolder/Logs/2009-06-08.log.
Logging works fine on a Windows XP machine, in debug mode, and when I deploy using my msi installer.
However, when I deploy on a Vista machine, nothing gets logged to the file.
I tried to add a MessageBox target just to check whether the Vista deployment was talking to the NLog dll at all, or if there were issues with the config file - and this works, so I assume this has to do specifically with creating a folder and/or creating/writing to a file in C:/Program Files (x86).
Can anybody help me see what I am not doing right?
Solution
Vista uses Files System Virtualisation to protect some folders. So your logs have been writen, but silently to another folder.