Where to store an application log file on Windows

Viewed 32672

Where would be the best "standard" place to put an application's debug log file in a Windows user environment?

In this particular case, it is an application that is run once and could go wrong. It will be run by system administrator types who may need to inspect the log after the application is run. Everytime the application is run, a new log file is created.

Options that have been floated so far include:

  1. The program directory
  2. The user's desktop
  3. The user's local Application Data directory.

I have my favourite, but I wondered what the SO consensus was.

Note: this is similar to this question, but we're dealing with an application that's only likely to be run once by one user.

7 Answers

Assuming you want to keep log files around a significant amount of time and they are intended to be used, read I would put the log file in a sub-folder of the user's local application data folder, accessible from windows explorer by typing %localappdata%.

If they are temporary log files, only to be used in the event of system diagnostics then you should put them in the temporary folder, accessible from windows explorer %temp%.

Related