What’s a conventional log location for processes that run on behalf of users?

  • ~/.foo/logs/ — my top choice but not super awesome

  • /var/log/foo.uid/ — Non-system users can’t create directories here, needs cooperation to create in the first place.

  • A common file in /var/log/ (e.g. /var/log/foo.log) — Not private

  • etc.


I would suggest going for /var/log/foo.uid/, because /var/log/ is my first go-to place when searching for logs on a server.

Another option is to use your first choice, ~/.foo/logs/, and create a symlink to it under /var/log.

  • I did actually mean user ID, not PID (i.e. more than one user may be running a program at the same time and they all need their own log locations). – s4y Nov 12 '12 at 7:21
  • Oh! My mistake, it's still a bit too early a monday morning. Then it makes sense to add the uid or username. – pkhamre Nov 12 '12 at 7:23

While /var/log is the canonical place to look for logs, as @pkhamre points out, I do not see the need to pollute the folder with "user"-generated logs. I would prefer only system-wide services to log to /var/log.

That said, if the app is a GUI app (running in X), I would suggest following the XDG Base Directory Specification and drop the logs into $XDG_DATA_HOME/foo/log/ with $XDG_DATA_HOME defaulting to $HOME/.local/share. This has one drawback, though. You need to work harder if you want to aggregate the logs for some reason -- with the previous solution a cat /var/log/foo.*/* would have been sufficient.


As /var/log is non writable by users and if you don't want to keep the logs under their respective home directories, I would suggest using /var/tmp/foo.logs.uid which would be both writable by users and centralized.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.