I have an application that logs, and I don’t get any file-based logging when I deploy it to the default directory. It seems clear that the reason is that writing to “c:\program files (x86)\blah” requires elevated privelege levels which my app doesn’t have. So I end up telling users “install to “c:\blah” and it will work fine, which it does. But that seems rubbish. Any alternative?
Share
You could configure NLog to log to a different folder. NLog has SpecialFolderLayoutRenderer that allows you to use .NET’s special folders. You should be able to specify the log file name using the SpecialFolderLayoutRenderer. Maybe something like this (I have not tried this):
That should (if it works) create log files in a
LogFilessubfolder in the user’sDocumentsfolder, with the actual log file names corresponding to the date. I don’t know, but I would guess that NLog will create the LogFiles folder the first time anything is logged.Good luck!