You are not logged in.

#1 2017-09-03 06:33:49

kryptxy
Member
Registered: 2017-06-11
Posts: 28

Where to store log file generated by non-root application

Hi,
I am trying to add logging functionality to a python app.

The app is intended to be run as a non-root user. Where should the logs be stored?
/var/log is owned by root, and thus cannot write in it as normal user.
What other locations can be used to save logs for non-root user?

Thank you!

Last edited by kryptxy (2017-09-03 06:34:12)

Offline

#2 2017-09-03 07:10:26

ooo
Member
Registered: 2013-04-10
Posts: 1,638

Re: Where to store log file generated by non-root application

XDG_DATA_HOME would be appropriate. For example Xorg uses it for rootless session's log files.

And/or you could write directly to systemd journal. Should be quite simple with python-systemd.
There's also 'systemd-cat' if someone's looking for this functionality for e.g. a bash script.

Last edited by ooo (2017-09-03 07:12:57)

Offline

#3 2017-09-03 07:19:46

kryptxy
Member
Registered: 2017-06-11
Posts: 28

Re: Where to store log file generated by non-root application

Thanks! I'd go with XDG_DATA_HOME.

Offline

Board footer

Powered by FluxBB