commit 076d8e3: [Minor] Preserve debug logging when running `rspamadm -v`

Vsevolod Stakhov vsevolod at highsecure.ru
Wed Mar 20 14:28:03 UTC 2019


Author: Vsevolod Stakhov
Date: 2019-03-20 14:03:30 +0000
URL: https://github.com/rspamd/rspamd/commit/076d8e3f5b12781acafe0e6de081b9041d6de208

[Minor] Preserve debug logging when running `rspamadm -v`

---
 src/libserver/cfg_file.h | 1 +
 src/libutil/logger.c     | 6 +++++-
 src/rspamadm/rspamadm.c  | 2 +-
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/libserver/cfg_file.h b/src/libserver/cfg_file.h
index 5b9e89c6c..fc61eae6b 100644
--- a/src/libserver/cfg_file.h
+++ b/src/libserver/cfg_file.h
@@ -71,6 +71,7 @@ enum rspamd_log_cfg_flags {
 	RSPAMD_LOG_FLAG_RE_CACHE = (1 << 2),
 	RSPAMD_LOG_FLAG_USEC = (1 << 3),
 	RSPAMD_LOG_FLAG_RSPAMADM = (1 << 4),
+	RSPAMD_LOG_FLAG_ENFORCED = (1 << 5),
 };
 
 struct rspamd_worker_log_pipe {
diff --git a/src/libutil/logger.c b/src/libutil/logger.c
index 7eb00f3fa..8238886da 100644
--- a/src/libutil/logger.c
+++ b/src/libutil/logger.c
@@ -459,7 +459,11 @@ rspamd_set_logger (struct rspamd_config *cfg,
 
 	logger->log_type = cfg->log_type;
 	logger->log_facility = cfg->log_facility;
-	logger->log_level = cfg->log_level;
+
+	if (!(logger->flags & RSPAMD_LOG_FLAG_ENFORCED)) {
+		logger->log_level = cfg->log_level;
+	}
+
 	logger->log_buffered = cfg->log_buffered;
 	logger->log_silent_workers = cfg->log_silent_workers;
 	logger->log_buf_size = cfg->log_buf_size;
diff --git a/src/rspamadm/rspamadm.c b/src/rspamadm/rspamadm.c
index c49853ef7..0c6ffd419 100644
--- a/src/rspamadm/rspamadm.c
+++ b/src/rspamadm/rspamadm.c
@@ -420,7 +420,7 @@ main (gint argc, gchar **argv, gchar **env)
 	/* Setup logger */
 	if (verbose) {
 		cfg->log_level = G_LOG_LEVEL_DEBUG;
-		cfg->log_flags |= RSPAMD_LOG_FLAG_USEC;
+		cfg->log_flags |= RSPAMD_LOG_FLAG_USEC|RSPAMD_LOG_FLAG_ENFORCED;
 	}
 	else {
 		cfg->log_level = G_LOG_LEVEL_MESSAGE;


More information about the Commits mailing list