Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linux: Logs directory may be more appropriate under XDG_CONFIG_HOME #148

Open
srenfo opened this issue Jun 10, 2020 · 2 comments
Open

Linux: Logs directory may be more appropriate under XDG_CONFIG_HOME #148

srenfo opened this issue Jun 10, 2020 · 2 comments

Comments

@srenfo
Copy link

srenfo commented Jun 10, 2020

user_log_dir is currently documented as follows:

        Unix:       ~/.cache/<AppName>/log  # or under $XDG_CACHE_HOME if defined

but I can't find a source for this convention (see also #26).

systemd uses $XDG_CONFIG_HOME/log/ for its LogsDirectory:

Directory Below path for system units Below path for user units Environment variable set
RuntimeDirectory= /run/ $XDG_RUNTIME_DIR $RUNTIME_DIRECTORY
StateDirectory= /var/lib/ $XDG_CONFIG_HOME $STATE_DIRECTORY
CacheDirectory= /var/cache/ $XDG_CACHE_HOME $CACHE_DIRECTORY
LogsDirectory= /var/log/ $XDG_CONFIG_HOME/log/ $LOGS_DIRECTORY
ConfigurationDirectory= /etc/ $XDG_CONFIG_HOME $CONFIGURATION_DIRECTORY

This is technically unrelated to the XDG spec but I suggest following this convention is better than following none. Of course, if someone can find a proper explicit convention that would be even better.

@KenKundert
Copy link

It appears that XDG is suggesting $XDG_STATE_HOME for log files:

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, …)

current state of the application that can be reused on a restart (view, layout, open files, undo history, …)

@sellout
Copy link

sellout commented Oct 24, 2024

One historical note (that may have influenced the systemd decision) is that earlier versions of the XDG Base Directory spec didn’t have XDG_STATE_HOME, so it left the place for logs, etc. up in the air.

XDG_STATE_HOME is definitely the correct place now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants