I am working on a WinForm application, that allows working to work with “projects” (think about the application as Visual Studio, and projects as VS Solutions).
My question is – where should the application keep its logging files?
Some requirements include:
- the application might not be running as an administrator (so saving in the %ProgramFiles% installation folder is not a good option)
- The logs should be accessible to end-users (either for review, or for sending to the support team). (This means that hard to find folders, like %AppData%\Company\Application\Version\ProjectName… are not a good solution either)
- The application might generate logs even when there are no open projects (so saving the logs in the project’s folder is good only when there’s a project, but not a final solution).
I was thinking of creating a “working folder” when the application is installed – something along the lines of C:\Application\, and then save the logs in a subfolder, like %WorkingFolder%\Logs\ProjectName
Thanks for the input.
Somewhere in the user’s directory is actually the correct place to store them if they are specific to the current running user.
Some programs create folders at the top level of the User’s directory, next to Documents and Desktop, others do it in Documents.
Creating it in C:\ might cause issues if the user doesn’t have write access to the root directory. You can pretty much guarantee the user will have write access to the Home directory.
The other option is to look for an environment variable, and if its set use the value as the location, if not default to the User’s home directory.