I have a C#.NET 4.0 app that uses log4net for logging. Under Windows XP, it’s always written log files to System.Windows.Forms.Application.CommonAppDataPath, and this works for admin users under Windows 7 as well, even with UAC set to its default level. When running as a limited user under Windows 7 with UAC at the same level, however, the log files don’t get written to.
Is there a way to get log4net to access those same rolling log files when running as a limited user, or am I forced to use System.Windows.Forms.Application.UserAppDataPath instead and have different log files for each user? I’d prefer to have a single set of rolling log files for all users if possible, as it makes customer support much easier.
Finally, the program must run “asInvoker,” so elevating the app isn’t an option.
I ended up doing a variation on sgmoore’s suggestion. I created a folder called C:\ProgramData\[CompanyName]\[ProductName]\logs, on which I enabled write access for the local Users group. This has the advantage of keeping minimal access for all other files in ProgramData while giving the necessary access on just the log files for those who need it.