diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/libserver/cfg_file.h | 1 | ||||
-rw-r--r-- | src/libserver/cfg_rcl.c | 7 | ||||
-rw-r--r-- | src/libserver/worker_util.c | 8 |
3 files changed, 16 insertions, 0 deletions
diff --git a/src/libserver/cfg_file.h b/src/libserver/cfg_file.h index ede88d9d7..da6ea5693 100644 --- a/src/libserver/cfg_file.h +++ b/src/libserver/cfg_file.h @@ -325,6 +325,7 @@ struct rspamd_config { gint log_level; /**< log level trigger */ gchar *log_file; /**< path to logfile in case of file logging */ gboolean log_buffered; /**< whether logging is buffered */ + gboolean log_silent_workers; /**< silence info messages from workers */ guint32 log_buf_size; /**< length of log buffer */ const ucl_object_t *debug_ip_map; /**< turn on debugging for specified ip addresses */ gboolean log_urls; /**< whether we should log URLs */ diff --git a/src/libserver/cfg_rcl.c b/src/libserver/cfg_rcl.c index 08c7c7868..6019d7c7d 100644 --- a/src/libserver/cfg_rcl.c +++ b/src/libserver/cfg_rcl.c @@ -217,6 +217,13 @@ rspamd_rcl_logging_handler (rspamd_mempool_t *pool, const ucl_object_t *obj, else if (g_ascii_strcasecmp (log_level, "info") == 0) { cfg->log_level = G_LOG_LEVEL_INFO | G_LOG_LEVEL_MESSAGE; } + else if (g_ascii_strcasecmp (log_level, "message") == 0) { + cfg->log_level = G_LOG_LEVEL_MESSAGE; + } + else if (g_ascii_strcasecmp (log_level, "silent") == 0) { + cfg->log_level = G_LOG_LEVEL_MESSAGE | G_LOG_LEVEL_INFO; + cfg->log_silent_workers = TRUE; + } else if (g_ascii_strcasecmp (log_level, "debug") == 0) { cfg->log_level = G_LOG_LEVEL_DEBUG; } diff --git a/src/libserver/worker_util.c b/src/libserver/worker_util.c index d2cca5b68..c041561f8 100644 --- a/src/libserver/worker_util.c +++ b/src/libserver/worker_util.c @@ -636,6 +636,14 @@ rspamd_fork_worker (struct rspamd_main *rspamd_main, /* Do silent log reopen to avoid collisions */ rspamd_log_close (rspamd_main->logger); + + + if (rspamd_main->cfg->log_silent_workers) { + rspamd_main->cfg->log_level = G_LOG_LEVEL_MESSAGE; + rspamd_set_logger (rspamd_main->cfg, cf->type, + &rspamd_main->logger, rspamd_main->server_pool); + } + rspamd_log_open (rspamd_main->logger); wrk->start_time = rspamd_get_calendar_ticks (); |