Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
add comment

3 Answers

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.

share|improve this answer
    
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). –  Sidnicious 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
add comment

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.

share|improve this answer
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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