diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2010-07-19 15:14:46 +0400 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2010-07-19 15:14:46 +0400 |
commit | c0b7a87e6aaa8dd90604d470ea6558ff53691e85 (patch) | |
tree | 10e5cfcb7160e48c595b11daa999d976e86e56e6 /src/logger.c | |
parent | dec1abd6e4582b74b658db72a7071ce098d1c9e5 (diff) | |
download | rspamd-c0b7a87e6aaa8dd90604d470ea6558ff53691e85.tar.gz rspamd-c0b7a87e6aaa8dd90604d470ea6558ff53691e85.zip |
* Reopen log file by USR1 signal
* Add reopenlog method to FreeBSD rc script
Diffstat (limited to 'src/logger.c')
-rw-r--r-- | src/logger.c | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/src/logger.c b/src/logger.c index 19ea767b8..f17835764 100644 --- a/src/logger.c +++ b/src/logger.c @@ -278,11 +278,13 @@ rspamd_set_logger (enum rspamd_log_type type, enum process_type ptype, struct co int reopen_log (void) { -#ifdef RSPAMD_MAIN - do_reopen_log = 0; -#endif close_log (); - return open_log (); + if (open_log () == 0) { + msg_info ("log file reopened"); + return 0; + } + + return -1; } void @@ -370,11 +372,7 @@ static void syslog_log_function (const gchar * log_domain, const gchar *function, GLogLevelFlags log_level, const gchar * message, gboolean forced, gpointer arg) { struct config_file *cfg = (struct config_file *)arg; -#ifdef RSPAMD_MAIN - if (do_reopen_log) { - reopen_log (); - } -#endif + if (! rspamd_log->enabled) { return; } @@ -427,11 +425,7 @@ file_log_function (const gchar * log_domain, const gchar *function, GLogLevelFla if (! rspamd_log->enabled) { return; } -#ifdef RSPAMD_MAIN - if (do_reopen_log) { - reopen_log (); - } -#endif + if (forced || log_level <= rspamd_log->cfg->log_level) { /* Check repeats */ |