summaryrefslogtreecommitdiff
path: root/main/logger.c
diff options
context:
space:
mode:
authorRichard Mudgett <rmudgett@digium.com>2014-12-22 20:08:35 +0000
committerRichard Mudgett <rmudgett@digium.com>2014-12-22 20:08:35 +0000
commitbbd9ff122ea91e55b58a3c0eb10f25acde25e21d (patch)
treeceb05e50a468851df04c94e91e19bbc521c2aadb /main/logger.c
parent264a50c52a5aa53d68839e5753bc5dd4d513793e (diff)
queue_log: Post QUEUESTART entry when Asterisk fully boots.
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/ ........ Merged revisions 430009 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 430010 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@430011 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/logger.c')
-rw-r--r--main/logger.c42
1 files changed, 26 insertions, 16 deletions
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 */