From dc7bd96ed7a5579834bae93f6feb09ba5b5f2bc8 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Thu, 20 Dec 2018 12:58:34 -0800 Subject: [PATCH] logging: Don't log to a log file Instead log only to the console and let daemon wrapper (systemd in Debian) take the logs from the console and log them to system log. There are many advantages for logging to system log instead of handling files on our own: - No need to handle log file rotation. This can be configured in many ways and we don't have to support that. System's log daemon handles this. Closes #1353. - Remaining system logs such as sudo and audit logs can be along with FreedomBox logs for better debugging. - It is possible to do remote logging based on system logger. - It is possible to make the logs tamper resistant based on system logger configuration. Since timestamp is automatically logged by system log daemon, remove timestamps from log format. When running on console, timestamps are not very useful. Reviewed-by: James Valleroy --- plinth/__main__.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/plinth/__main__.py b/plinth/__main__.py index dd58cb30b..8e4ea3544 100644 --- a/plinth/__main__.py +++ b/plinth/__main__.py @@ -161,22 +161,17 @@ def configure_django(): 'formatters': { 'default': { 'format': - '[%(asctime)s] %(name)-14s %(levelname)-8s %(message)s', + '%(name)-14s %(levelname)-8s %(message)s', } }, 'handlers': { - 'file': { - 'class': 'logging.FileHandler', - 'filename': cfg.status_log_file, - 'formatter': 'default' - }, 'console': { 'class': 'logging.StreamHandler', 'formatter': 'default' } }, 'root': { - 'handlers': ['console', 'file'], + 'handlers': ['console'], 'level': 'DEBUG' if cfg.develop else 'INFO' } }