views:

243

answers:

1

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?

+1  A: 

Vista uses Files System Virtualisation to protect some folders. So your logs have been writen, but silently to another folder.

Daniel Brückner
Thank you, that does it. To summarize, the log file IS getting written, but instead of going to C:/Program Files (x86)/MyApplicationFolder/ , in Vista, it goes to C:/Users/JohnDoe/AppData/Local/VirtualStore/Program Files (x86)/ etc...
Mathias