]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
queue_log: Post QUEUESTART entry when Asterisk fully boots.
authorRichard Mudgett <rmudgett@digium.com>
Mon, 22 Dec 2014 19:38:58 +0000 (19:38 +0000)
committerRichard Mudgett <rmudgett@digium.com>
Mon, 22 Dec 2014 19:38:58 +0000 (19:38 +0000)
The QUEUESTART log entry has historically acted like a fully booted event
for the queue_log file.  When the QUEUESTART entry was posted to the log
was broken by the change made by ASTERISK-15863.

* Made post the QUEUESTART queue_log entry when Asterisk fully boots.
This restores the intent of that log entry and happens after realtime has
had a chance to load.

AST-1444 #close
Reported by: Denis Martinez

Review: https://reviewboard.asterisk.org/r/4282/

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@430009 65c4cc65-6c06-0410-ace0-fbb531ad65f3

include/asterisk/_private.h
main/asterisk.c
main/logger.c

index a7ed68136f3212ae6b155f88c1c3df611dc1cc05..1bc24337f0415858504178cf2d84857617307277 100644 (file)
@@ -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 init_framer(void);                 /*!< Provided by frame.c */
 int ast_term_init(void);               /*!< Provided by term.c */
index 660fe2af536beced8744341a9783800fe59e6400..2fecf242e14e7578d84d071dac2fb529f3308fda 100644 (file)
@@ -4380,6 +4380,8 @@ int main(int argc, char *argv[])
 
        run_startup_commands();
 
+       logger_queue_start();
+
        if (ast_opt_console) {
                /* Console stuff now... */
                /* Register our quit function */
index e0e012e52f1f7ac008810c7a6d85cb1ac942c9e9..323f1c6e6306bbcdac8ec33973f9e6efc4a7864e 100644 (file)
@@ -235,8 +235,6 @@ AST_THREADSTORAGE(verbose_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;
@@ -548,20 +546,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")) {
@@ -1265,6 +1251,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 */