mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-01-21 07:55:00 +00:00
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:
parent
a541ea06b7
commit
dc7bd96ed7
@ -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'
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user