diff options
author | Jason Parker <jparker@digium.com> | 2006-09-26 17:09:01 +0000 |
---|---|---|
committer | Jason Parker <jparker@digium.com> | 2006-09-26 17:09:01 +0000 |
commit | fe1a3b88777c31ddbf1a9d001df1055060d4b5f1 (patch) | |
tree | b676942e9d5273c20ae5f322b2d6fde63e61ccff | |
parent | ec83b111831fe865753f5b1c382ab73750685e50 (diff) |
Add optional queue_log_name config option for logger.conf, to change the
name of the queue_log file.
Issue #7363, patch by Steve Davies, slightly modified by me.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@43666 65c4cc65-6c06-0410-ace0-fbb531ad65f3
-rw-r--r-- | configs/logger.conf.sample | 4 | ||||
-rw-r--r-- | main/logger.c | 10 |
2 files changed, 11 insertions, 3 deletions
diff --git a/configs/logger.conf.sample b/configs/logger.conf.sample index f2ff0ea7e..575d4d8e8 100644 --- a/configs/logger.conf.sample +++ b/configs/logger.conf.sample @@ -20,6 +20,10 @@ ; (defaults to yes). ;queue_log = no ; +; Set the queue_log filename +; (defaults to queue_log) +;queue_log_name = queue_log +; ; This determines whether or not we log generic events to a file ; (defaults to yes). ;event_log = no diff --git a/main/logger.c b/main/logger.c index ec49d79b9..10534bd6c 100644 --- a/main/logger.c +++ b/main/logger.c @@ -83,6 +83,8 @@ static int syslog_level_map[] = { static char dateformat[256] = "%b %e %T"; /* Original Asterisk Format */ +static char queue_log_name[256] = QUEUELOG; + static int filesize_reload_needed = 0; static int global_logmask = -1; @@ -336,6 +338,8 @@ static void init_logger_chain(void) logfiles.queue_log = ast_true(s); if ((s = ast_variable_retrieve(cfg, "general", "event_log"))) logfiles.event_log = ast_true(s); + if ((s = ast_variable_retrieve(cfg, "general", "queue_log_name"))) + ast_copy_string(queue_log_name, s, sizeof(queue_log_name)); AST_LIST_LOCK(&logchannels); var = ast_variable_browse(cfg, "logfiles"); @@ -450,10 +454,10 @@ int reload_logger(int rotate) } if (logfiles.queue_log) { - snprintf(old, sizeof(old), "%s/%s", (char *)ast_config_AST_LOG_DIR, QUEUELOG); + snprintf(old, sizeof(old), "%s/%s", (char *)ast_config_AST_LOG_DIR, queue_log_name); if (queue_rotate) { for (x = 0; ; x++) { - snprintf(new, sizeof(new), "%s/%s.%d", (char *)ast_config_AST_LOG_DIR, QUEUELOG, x); + snprintf(new, sizeof(new), "%s/%s.%d", (char *)ast_config_AST_LOG_DIR, queue_log_name, x); myf = fopen((char *)new, "r"); if (myf) /* File exists */ fclose(myf); @@ -610,7 +614,7 @@ int init_logger(void) } if (logfiles.queue_log) { - snprintf(tmp, sizeof(tmp), "%s/%s", (char *)ast_config_AST_LOG_DIR, QUEUELOG); + snprintf(tmp, sizeof(tmp), "%s/%s", (char *)ast_config_AST_LOG_DIR, queue_log_name); qlog = fopen(tmp, "a"); ast_queue_log("NONE", "NONE", "NONE", "QUEUESTART", "%s", ""); } |