From 45293e32d6b844a1726c502933a8f05256866954 Mon Sep 17 00:00:00 2001 From: Patrick Cloke Date: Tue, 6 Oct 2020 12:36:57 -0400 Subject: [PATCH 1/2] Include the loglevel of synapse.app.homeserver in phone home stats. --- changelog.d/8477.misc | 1 + synapse/app/phone_stats_home.py | 6 ++++++ 2 files changed, 7 insertions(+) create mode 100644 changelog.d/8477.misc diff --git a/changelog.d/8477.misc b/changelog.d/8477.misc new file mode 100644 index 000000000000..2ee1606b6e32 --- /dev/null +++ b/changelog.d/8477.misc @@ -0,0 +1 @@ +Include the log level in the phone home stats. diff --git a/synapse/app/phone_stats_home.py b/synapse/app/phone_stats_home.py index 2c8e14a8c0ca..05a1fab12524 100644 --- a/synapse/app/phone_stats_home.py +++ b/synapse/app/phone_stats_home.py @@ -113,6 +113,12 @@ async def phone_stats_home(hs, stats, stats_process=_stats_process): stats["database_engine"] = hs.get_datastore().db_pool.engine.module.__name__ stats["database_server_version"] = hs.get_datastore().db_pool.engine.server_version + # + # Logging configuration + # + log_level = logger.getEffectiveLevel() + stats["log_level"] = logging.getLevelName(log_level) + logger.info("Reporting stats to %s: %s" % (hs.config.report_stats_endpoint, stats)) try: await hs.get_proxied_http_client().put_json( From 368eb5d92e9a86f10c0692ed0592308ca79b8397 Mon Sep 17 00:00:00 2001 From: Patrick Cloke Date: Wed, 7 Oct 2020 10:14:52 -0400 Subject: [PATCH 2/2] Use the synapse logger. --- synapse/app/phone_stats_home.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/synapse/app/phone_stats_home.py b/synapse/app/phone_stats_home.py index 05a1fab12524..daed8ccfe952 100644 --- a/synapse/app/phone_stats_home.py +++ b/synapse/app/phone_stats_home.py @@ -116,7 +116,8 @@ async def phone_stats_home(hs, stats, stats_process=_stats_process): # # Logging configuration # - log_level = logger.getEffectiveLevel() + synapse_logger = logging.getLogger("synapse") + log_level = synapse_logger.getEffectiveLevel() stats["log_level"] = logging.getLevelName(log_level) logger.info("Reporting stats to %s: %s" % (hs.config.report_stats_endpoint, stats))