diff options
-rw-r--r-- | include/asterisk/_private.h | 1 | ||||
-rw-r--r-- | main/asterisk.c | 2 | ||||
-rw-r--r-- | main/logger.c | 42 |
3 files changed, 29 insertions, 16 deletions
diff --git a/include/asterisk/_private.h b/include/asterisk/_private.h index 5c80bf0e9..d49de1789 100644 --- a/include/asterisk/_private.h +++ b/include/asterisk/_private.h @@ -19,6 +19,7 @@ int load_modules(unsigned int); /*!< Provided by loader.c */ int load_pbx(void); /*!< Provided by pbx.c */ int init_logger(void); /*!< Provided by logger.c */ void close_logger(void); /*!< Provided by logger.c */ +void logger_queue_start(void); /*!< Provided by logger.c */ void clean_time_zones(void); /*!< Provided by localtime.c */ int ast_term_init(void); /*!< Provided by term.c */ int astdb_init(void); /*!< Provided by db.c */ diff --git a/main/asterisk.c b/main/asterisk.c index 0a5ab1335..7378d2271 100644 --- a/main/asterisk.c +++ b/main/asterisk.c @@ -4592,6 +4592,8 @@ int main(int argc, char *argv[]) ast_verb(0, COLORIZE_FMT "\n", COLORIZE(COLOR_BRGREEN, 0, "Asterisk Ready.")); + logger_queue_start(); + if (ast_opt_console) { /* Console stuff now... */ /* Register our quit function */ diff --git a/main/logger.c b/main/logger.c index 568a6d2e5..c59c7ce6d 100644 --- a/main/logger.c +++ b/main/logger.c @@ -241,8 +241,6 @@ AST_THREADSTORAGE(verbose_build_buf); AST_THREADSTORAGE(log_buf); #define LOG_BUF_INIT_SIZE 256 -static void logger_queue_init(void); - static void make_components(struct logchannel *chan) { char *w; @@ -560,20 +558,8 @@ void ast_queue_log(const char *queuename, const char *callid, const char *agent, return; } if (!queuelog_init) { - AST_RWLIST_WRLOCK(&logchannels); - if (!queuelog_init) { - /* - * We have delayed initializing the queue logging system so - * preloaded realtime modules can get up. We must initialize - * now since someone is trying to log something. - */ - logger_queue_init(); - queuelog_init = 1; - AST_RWLIST_UNLOCK(&logchannels); - ast_queue_log("NONE", "NONE", "NONE", "QUEUESTART", "%s", ""); - } else { - AST_RWLIST_UNLOCK(&logchannels); - } + /* We must initialize now since someone is trying to log something. */ + logger_queue_start(); } if (ast_check_realtime("queue_log")) { @@ -1397,6 +1383,30 @@ static void logger_queue_init(void) } } +/*! + * \brief Start the ast_queue_log() logger. + * + * \note Called when the system is fully booted after startup + * so preloaded realtime modules can get up. + * + * \return Nothing + */ +void logger_queue_start(void) +{ + /* Must not be called before the logger is initialized. */ + ast_assert(logger_initialized); + + AST_RWLIST_WRLOCK(&logchannels); + if (!queuelog_init) { + logger_queue_init(); + queuelog_init = 1; + AST_RWLIST_UNLOCK(&logchannels); + ast_queue_log("NONE", "NONE", "NONE", "QUEUESTART", "%s", ""); + } else { + AST_RWLIST_UNLOCK(&logchannels); + } +} + int init_logger(void) { /* auto rotate if sig SIGXFSZ comes a-knockin */ |