[asterisk-dev] [Code Review] VERBOSE message shows up on console when 'debug' enabled in logger.conf

Brett Bryant brettbryant at gmail.com
Mon Sep 20 16:13:16 CDT 2010


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/915/
-----------------------------------------------------------

(Updated 2010-09-20 16:13:16.401493)


Review request for Asterisk Developers.


Summary
-------

This patch fixes an issue where calling ast_verbose would place formatted verbose messages to the console when it wasn't supposed to.


This addresses bug 17974.
    https://issues.asterisk.org/view.php?id=17974


Diffs
-----

  /branches/1.8/main/logger.c 286375 

Diff: https://reviewboard.asterisk.org/r/915/diff


Testing (updated)
-------

So as it turns out the reason that the messages were being printed out
ONLY when syslog was enabled, was that the verbose log messages were
incorrectly being handled by logger_print_normal (fixed in my patch on
reviewboard) instead of logger_print_verbose. This was an interesting
bug, so the following things happened:

        -> logger_print_normal began iterating through the logchannels to
handle the message
        -> logger_print_normal used ast_log_vsyslog to handle the message for
the syslog log channel
        -> ast_log_vsyslog, for reasons unknown to me, changed the message's
level to __LOG_DEBUG if it was __LOG_VERBOSE (on monday, I'm going to do
svn blame for this particular piece of code and try and figure out why
it's reasonable to do that before calling syslog)
        -> control returns back to logger_print_normal, where it iterates to
the next channel
        -> since the message type is now __LOG_DEBUG it gets handled by a
LOGTYPE_CONSOLE (which has a check to ignore __LOG_VERBOSE messages,
btw) and gets printed to the console

Also, just for fun. A few things could have been different for this
error not to occur (explaining, probably, why it was so rare)

        -> the syslog line in logger.conf could have appeared before the
console line
        -> the logmessages queue could have been populated with INSERT_TAIL
instead INSERT_HEAD


Thanks,

Brett




More information about the asterisk-dev mailing list