From ddec99b89974cc470ae5dd2a4ddef6a9c4b7581c Mon Sep 17 00:00:00 2001 From: Aaron Raimist Date: Wed, 14 Nov 2018 13:39:52 -0600 Subject: [PATCH] Allow Synapse log levels to be configured (#23) --- CHANGELOG.md | 14 ++++++++++++++ roles/matrix-server/defaults/main.yml | 8 ++++++++ .../templates/synapse/synapse.log.config.j2 | 6 +++--- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d9c33ca9..f13d6a68 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,17 @@ +# 2018-11-14 + +## Ability to set Synapse log levels + +The playbook now allows you to set the log levels used by Synapse. The default logging levels remain the same. + +You can now override following variables with any of the supported log levels listed here: https://docs.python.org/3/library/logging.html#logging-levels + +``` +matrix_synapse_log_level: "INFO" +matrix_synapse_storage_sql_log_level: "INFO" +matrix_synapse_root_log_level: "INFO" +``` + # 2018-11-03 ## Customize parts of Riot's config diff --git a/roles/matrix-server/defaults/main.yml b/roles/matrix-server/defaults/main.yml index 55768c40..fef3b0e0 100644 --- a/roles/matrix-server/defaults/main.yml +++ b/roles/matrix-server/defaults/main.yml @@ -63,6 +63,14 @@ matrix_synapse_max_upload_size_mb: 10 matrix_synapse_max_log_file_size_mb: 100 matrix_synapse_max_log_files_count: 10 +# Log levels +# Possible options are defined here https://docs.python.org/3/library/logging.html#logging-levels +# warning: setting log level to DEBUG will make synapse log sensitive information such +# as access tokens +matrix_synapse_log_level: "INFO" +matrix_synapse_storage_sql_log_level: "INFO" +matrix_synapse_root_log_level: "INFO" + # Rate limits matrix_synapse_rc_messages_per_second: 0.2 matrix_synapse_rc_message_burst_count: 10.0 diff --git a/roles/matrix-server/templates/synapse/synapse.log.config.j2 b/roles/matrix-server/templates/synapse/synapse.log.config.j2 index 2cd6ea57..b551047c 100644 --- a/roles/matrix-server/templates/synapse/synapse.log.config.j2 +++ b/roles/matrix-server/templates/synapse/synapse.log.config.j2 @@ -25,12 +25,12 @@ handlers: loggers: synapse: - level: INFO + level: {{ matrix_synapse_log_level }} synapse.storage.SQL: # beware: increasing this to DEBUG will make synapse log sensitive # information such as access tokens. - level: INFO + level: {{ matrix_synapse_storage_sql_log_level }} {% for logger in matrix_synapse_additional_loggers %} {{ logger.name }}: @@ -38,5 +38,5 @@ loggers: {% endfor %} root: - level: INFO + level: {{ matrix_synapse_root_log_level }} handlers: [file, console]