diff --git a/data/usr/lib/systemd/system/plinth.service b/data/usr/lib/systemd/system/plinth.service index 85a6abda7..3133e2c61 100644 --- a/data/usr/lib/systemd/system/plinth.service +++ b/data/usr/lib/systemd/system/plinth.service @@ -17,8 +17,6 @@ RestartSec=5 ExecReload=/bin/kill -HUP $MAINPID User=plinth Group=plinth -StandardOutput=null -StandardError=null NotifyAccess=main # Uploaded files in /var/tmp/ are shared with FreedomBox privileged service by # joining namespaces. diff --git a/plinth/log.py b/plinth/log.py index d77a66d5d..02d23c917 100644 --- a/plinth/log.py +++ b/plinth/log.py @@ -5,6 +5,7 @@ Setup logging for the application. import logging import logging.config +import sys import typing import warnings @@ -158,5 +159,11 @@ def get_configuration(): } } } + if not sys.stdin.isatty(): + # If running on a console, say due to user manually starting it, then + # log everything to console. However, if we are running as a systemd + # unit then no need to log to console. This allows us to capture + # stdout/stderr in systemd unit without repeating the log messages. + configuration['root']['handlers'].remove('console') return configuration