Where are all the posibilities of storing a log file

6,219

If the program is not a daemon, the XDG Base Directory Specification specifies that:

The $XDG_STATE_HOME contains state data that should persist between (application) restarts, but that is not important or portable enough to the user that it should be stored in $XDG_DATA_HOME. It may contain:

  • actions history (logs, history, recently used files, …) […]

and:

If $XDG_STATE_HOME is either not set or empty, a default equal to $HOME/.local/state should be used.

Share:
6,219

Related videos on Youtube

Joshua Strot
Author by

Joshua Strot

Updated on September 18, 2022

Comments

  • Joshua Strot
    Joshua Strot almost 2 years

    I'm writing a program, and would like it to store a log file. Problem is, the program really shouldn't be ran as root.

    So if I wanted to uphold to the traditions of where files are placed, where could I keep the log file if not in /var/log that a normal user would have permissions to?

    Edit: I'm using Arch linux.

  • Admin
    Admin over 10 years
    My bad, I should add that I'm using arch linux. I'm not sure I would want method since this will be going into a package. I was really more hoping that there might a folder inside of a users home directory that could be used to hold log files.
  • Admin
    Admin over 10 years
    Ok, so help me to understand. This program will be run by "normal users"(like password, cd, yes...), or a daemon or some server software that needs to run as a normal user or administrative user to reduce the risks of your system being compromised? I don't se a more appropriated place to put user logs, since even the FHS does not talk about it - refspecs.linuxfoundation.org/FHS_2.3/fhs-2.3.html. Maybe: /home/user/.your_app/logs like almost all applications do on users home folders to handle config files and stuff ;)