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 <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa 2018-12-20 12:58:34 -08:00 committed by James Valleroy
parent a541ea06b7
commit dc7bd96ed7
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808

View File

@ -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'
}
}