mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-01-21 07:55:00 +00:00
logging: Log to systemd journal directly
While capturing stdout and stderr and automatically logging that to system logging daemon provides basic information, a lot of information lost in the process. This change logs to systemd journal directly so that rich information such as code file, code function, code line, etc, can be captured in a structured way. To avoid double logging, discard stdout and stderr in the systemd unit file. Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
dc7bd96ed7
commit
f36753fcb8
@ -16,7 +16,7 @@
|
||||
#
|
||||
|
||||
[Unit]
|
||||
Description=Plinth Web Interface
|
||||
Description=FreedomBox Service (Plinth)
|
||||
Documentation=man:plinth(1)
|
||||
After=network.target
|
||||
|
||||
@ -26,6 +26,8 @@ Restart=on-failure
|
||||
ExecReload=/bin/kill -HUP $MAINPID
|
||||
User=plinth
|
||||
Group=plinth
|
||||
StandardOutput=null
|
||||
StandardError=null
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
||||
1
debian/control
vendored
1
debian/control
vendored
@ -38,6 +38,7 @@ Build-Depends: debhelper (>= 11~)
|
||||
, python3-setuptools-git
|
||||
, python3-yaml
|
||||
, xmlto
|
||||
Recommends: python3-systemd
|
||||
Standards-Version: 4.2.1
|
||||
Homepage: https://salsa.debian.org/freedombox-team/plinth
|
||||
Vcs-Git: https://salsa.debian.org/freedombox-team/plinth.git
|
||||
|
||||
@ -176,6 +176,17 @@ def configure_django():
|
||||
}
|
||||
}
|
||||
|
||||
try:
|
||||
importlib.import_module('systemd.journal')
|
||||
except ModuleNotFoundError:
|
||||
pass
|
||||
else:
|
||||
logging_configuration['handlers']['journal'] = {
|
||||
'class': 'systemd.journal.JournalHandler'
|
||||
}
|
||||
logging_configuration['root']['handlers'].append('journal')
|
||||
|
||||
|
||||
templates = [
|
||||
{
|
||||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user