This question is about log files produced by simple user applications. The files are specific to the user. Because of that /var/log is not a solution here.

I can not find informations about such files in the XDG Specificiations.

Where should they be stored by default?


2 Answers 2


The XDG spec is not very clear on where log files should go. The best fit seems to be under $XDG_CACHE_HOME which is for "user specific non-essential data files".

Looking at my local system, there are application logs under all of the $XDG_*_HOME locations:

$ ls .cache/*/*log

$ ls .local/share/*/*log

$ ls .config/*/*log

Using $XDG_CONFIG_HOME seems wrong, but can see using the (more likely to persist through reboots) $XDG_DATA_HOME specifically for applications like Xorg which may break hard enough to require a system restart and want to be able to preserve error logs in these scenarios.


They belong in $XDG_STATE_HOME or (as fallback) ~/.local/state.

When this question was asked, the then current specification didn't have $XDG_STATE_HOME. It was introduced in 2021 by Version 0.8.

From the current spec:

$XDG_STATE_HOME defines the base directory relative to which user-specific state files should be stored. If $XDG_STATE_HOME is either not set or empty, a default equal to $HOME/.local/state should be used.

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .