From 9dc965eadd8826f6e69327821c7d3214bf901bd5 Mon Sep 17 00:00:00 2001 From: Olle Johansson Date: Thu, 6 Dec 2007 14:23:12 +0000 Subject: [PATCH] Merged revisions 91366 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r91366 | oej | 2007-12-06 13:54:11 +0100 (Tor, 06 Dec 2007) | 4 lines Make sure logger is reloaded at general reload in the cli. (Discovered during Asterisk training in Portugal) ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@91384 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- include/asterisk/logger.h | 3 +++ main/loader.c | 1 + main/logger.c | 17 +++++++++++++---- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/include/asterisk/logger.h b/include/asterisk/logger.h index cf33e48f24..8cc8d622ab 100644 --- a/include/asterisk/logger.h +++ b/include/asterisk/logger.h @@ -63,6 +63,9 @@ void ast_log(int level, const char *file, int line, const char *function, const void ast_backtrace(void); +/*! \brief Reload logger without rotating log files */ +int logger_reload(void); + void ast_queue_log(const char *queuename, const char *callid, const char *agent, const char *event, const char *fmt, ...) __attribute__ ((format (printf, 5, 6))); diff --git a/main/loader.c b/main/loader.c index 02fb8a905d..ce8a319ba7 100644 --- a/main/loader.c +++ b/main/loader.c @@ -251,6 +251,7 @@ static struct reload_classes { { "manager", reload_manager }, { "rtp", ast_rtp_reload }, { "http", ast_http_reload }, + { "logger", logger_reload }, { NULL, NULL } }; diff --git a/main/logger.c b/main/logger.c index cf994a5497..00fbdaecde 100644 --- a/main/logger.c +++ b/main/logger.c @@ -616,6 +616,15 @@ static int reload_logger(int rotate) return res; } +/*! \brief Reload the logger module without rotating log files (also used from loader.c during + a full Asterisk reload) */ +int logger_reload(void) +{ + if(reload_logger(0)) + return RESULT_FAILURE; + return RESULT_SUCCESS; +} + static char *handle_logger_reload(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { switch (cmd) { @@ -631,8 +640,8 @@ static char *handle_logger_reload(struct ast_cli_entry *e, int cmd, struct ast_c if (reload_logger(0)) { ast_cli(a->fd, "Failed to reload the logger\n"); return CLI_FAILURE; - } else - return CLI_SUCCESS; + } + return CLI_SUCCESS; } static char *handle_logger_rotate(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) @@ -650,8 +659,8 @@ static char *handle_logger_rotate(struct ast_cli_entry *e, int cmd, struct ast_c if (reload_logger(1)) { ast_cli(a->fd, "Failed to reload the logger and rotate log files\n"); return CLI_FAILURE; - } else - return CLI_SUCCESS; + } + return CLI_SUCCESS; } /*! \brief CLI command to show logging system configuration */