I
I
ixSci2011-03-13 10:43:41
linux
ixSci, 2011-03-13 10:43:41

Where to put your application logs in Linux?

There was a need to store application logs, more precisely, one log file. Tell me, please, where is it customary to add log files in Linux? So that the user expects them there. Maybe there is some guide on the location of Linux application data? I would be grateful for links.
I tried to put the log in / var / log but got a kick from the ACL, actually w is forbidden there for a mere mortal.
Thanks in advance!

Answer the question

In order to leave comments, you need to log in

6 answer(s)
S
shadowalone, 2011-03-13
@ixSci

When installing your application package, let the /var/log/your_apps folder be created with the appropriate permissions, in this folder and put the logs.
in my opinion, the path for the logs, in this case, is more than obvious.
This is how many applications do it.

M
merlin-vrn, 2011-03-13
@merlin-vrn

Write to syslog. #include <syslog.h>

H
holivar, 2011-03-13
@holivar

In Linux, it is accepted that the location of the log file can be set by the user, and the standard location of the logs depends on the distribution.
On different distributions, when a user installs a package through a manager like yum or apt-get, he does so as root and can only write to his own file created by the manager. So the best way is to default all logs, executables, etc. - put in one folder, but allow all paths to be configured so that the user / package manager takes responsibility, otherwise your application simply will not work for different users

V
Vladimir Chernyshev, 2011-03-13
@VolCh

I like this default practice:
- if the application is installed in /usr (or another system directory), then the logs are written to /var/log (to install in /usr, you need root rights, so create and configure write permissions to /var/ log should not be a problem - you can open an entry for everyone, you can create a group into which to add users who have the right to run)
- if the application is installed in ~, then the logs are written to ~
/ ./log » applications is somehow annoying.

F
fun, 2011-03-13
@fun

/etc/temp/%appname%/log

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question