Summary:ASTERISK-07859: [patch] Add option_debug checks before blindly writing to DEBUG logging channel
Reporter:Curt Moore (jcmoore)Labels:
Date Opened:2006-10-02 17:03:55Date Closed:2006-10-03 10:53:22
Versions:Frequency of
Environment:Attachments:( 0) option_debug.patch.txt
Description:Many times within the Asterisk codebase, a LOG_DEBUG message is made without first checking to see if debugging is enabled and the debug channel exists.  While not a big deal, a check should probably be done before writing data to the DEBUG log channel.  I've heard developers say occasinally that it's generally a "bad" practice to write without first doing a check and could cause ill effects.

I would prefer that someone with _all_ of the dependecies necessary to build all modules try this patch to ensure that everything actually compiles before it's committed as I had to include "asterisk/options.h" in a few files in order for them to pick up on the "option_debug" variable.  Everything for which I have dependencies compiles without issue.

As always, please let me know if there are questions about this diff, espicially since it is rather large.  I can split it up into smaller diffs if necessary.


Also be aware, this patch changes the functionality of the way "dumphistory" works in chan_sip.  Previously, the sip_dump_history() function would blindly dump the SIP dialog information to the DEBUG log channel without the needing debugging to be enabled.  With these changes, an option_debug check is first done before writing the sip_history to the DEBUG channel.  This means that in order for "dumphistory" to actually work, either the general Asterisk debugging option must be >= 1 or SIP debugging must be enabled.  If this is too great of a change or is not what is desired, please remove that portion of the patch.
Comments:By: Matt O'Gorman (mogorman) 2006-10-03 10:53:21

Committed revision 44253.