]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
logger: Always enable verbose for console channel. 34/3934/2
authorCorey Farrell <git@cfware.com>
Tue, 20 Sep 2016 14:22:45 +0000 (10:22 -0400)
committerCorey Farrell <git@cfware.com>
Tue, 20 Sep 2016 16:58:59 +0000 (12:58 -0400)
Previous versions of Asterisk did not require verbose to be specified in
logger.conf for the console channel, if it was requested by command line
or asterisk.conf it just worked.  This change causes Asterisk to always
enable verbose in the console channel level mask.  Verbose is displayed
on consoles if requested by command line, option_verbose or 'core set
verbose'.

This also delays initialization of the logger until after threadstorage
is initialized.  Initializing too early can cause messages to be printed
multiple times to the console (stdout).

ASTERISK-26391 #close

Change-Id: I52187d67c2fcb3efd5561bf04b3e5e23e5ee8a04

main/asterisk.c
main/logger.c

index 7b1338c3dcf0eeb7824a2f5805972a74cb611d3c..fb47d9927e34cdf98756d67e940fcd711a7d7dcf 100644 (file)
@@ -4448,7 +4448,6 @@ static void asterisk_daemon(int isroot, const char *runuser, const char *rungrou
        check_init(ast_format_cache_init(), "Format Cache");
        check_init(ast_codec_builtin_init(), "Built-in Codecs");
        check_init(aco_init(), "Configuration Option Framework");
-       check_init(init_logger(), "Logger");
        check_init(ast_bucket_init(), "Bucket API");
        check_init(stasis_init(), "Stasis");
        check_init(ast_stasis_system_init(), "Stasis system-level information");
@@ -4478,6 +4477,7 @@ static void asterisk_daemon(int isroot, const char *runuser, const char *rungrou
 
        threadstorage_init();
 
+       check_init(init_logger(), "Logger");
        check_init(ast_rtp_engine_init(), "RTP Engine");
 
        ast_autoservice_init();
index db3d7a730a1953495c72b9758d557f463d409431..315de9f231cef46e634f041da5cff4277a8dfd08 100644 (file)
@@ -479,6 +479,7 @@ static void make_components(struct logchannel *chan)
                 * with calculating the ast_verb_sys_level value.
                 */
                chan->verbosity = -1;
+               logmask |= (1 << __LOG_VERBOSE);
        } else {
                chan->verbosity = verb_level;
        }
@@ -663,7 +664,8 @@ static int init_logger_chain(const char *altconf)
                        return -1;
                }
                chan->type = LOGTYPE_CONSOLE;
-               chan->logmask = (1 << __LOG_WARNING) | (1 << __LOG_NOTICE) | (1 << __LOG_ERROR);
+               chan->logmask = (1 << __LOG_WARNING) | (1 << __LOG_NOTICE) | (1 << __LOG_ERROR)
+                       | (1 << __LOG_VERBOSE);
                memcpy(&chan->formatter, &logformatter_default, sizeof(chan->formatter));
 
                AST_RWLIST_INSERT_HEAD(&logchannels, chan, list);