1

I am creating a cross-platform app and would like to write some information to a log file. I know that I can dump it on the desktop or any number of unexpected places, but I am interested in placing it in the place where each operating system recommends. To complicate matters, systemd may be present and change expectations based on the platform.

Where is the expected place for Linux? And are there any other expectations I should be aware of (like if I need to put it in a folder with my company or app name)?

jww
  • 97,681
  • 90
  • 411
  • 885
Thunderforge
  • 19,637
  • 18
  • 83
  • 130
  • 1
    Use the `syslog()` function. This sends to a logging daemon, and it has a configuration file that says where the files are stored. – Barmar Jul 14 '17 at 02:23
  • 1
    Log files are typically put in `/var/log` – Barmar Jul 14 '17 at 02:24
  • [Where to place a debug log files for my daemon app?](https://stackoverflow.com/q/3067725), [Where does linux store my syslog?](https://stackoverflow.com/q/10979435), [How to choose the location of a log file for an application in a platform independent way?](https://stackoverflow.com/q/3275359), [How to configure syslog so that an applications log goes to a specific file](https://stackoverflow.com/q/10376020), [How to write an C/C++ application that writes to a /var/log/myapp](https://stackoverflow.com/q/16800155/608639), [Daemon Logging in Linux](https://stackoverflow.com/q/158457), etc – jww Jul 14 '17 at 09:42

0 Answers0