Adam
Adam

Reputation: 712

Standard log locations for a cross platform application

I'm developing a cross-platform desktop application for Mac, Linux and Windows. The application will create a plain-text log file to help with debugging, amongst other things. What are people's recommendations for a sensible place to store the log on each of the platforms?

Here is my guess so far, based on web searches:

Upvotes: 2

Views: 669

Answers (1)

Florian Weimer
Florian Weimer

Reputation: 33719

For Linux, the XDG Base Directory Specification is followed by some applications. Log files are not specifically called out as such. You can put them either into a subdirectory of the data directory ($XDG_DATA_HOME or $HOME/.local/share), where they will not be deleted automatically, or you could use a subdirectory of the cache directory ($XDG_CACHE or $HOME/.cache). In the latter case, the files could be automatically expired after some time.

Upvotes: 1

Related Questions