[Asterisk-Dev] Debugging: selectable feature?

Tilghman Lesher tilghman at mail.jeffandtilghman.com
Thu Jan 27 21:50:49 MST 2005


On Thursday 27 January 2005 22:00, Michael Giagnocavo wrote:
> >> >Log levels, like verbose levels, are currently enabled
> >> > globally. There is no facility currently to enable certain
> >> > modules to log more or be more verbose than others.  It's all
> >> > or nothing.
> >>
> >> That's too bad.  My experiences with debugging individual calls
> >> which create error conditions (crashes, PRI problems, SIP
> >> problems, whatever) have been difficult, to say the least.  The
> >> lack of timestamps or channel indications on the output is
> >> discouraging in high-churn call environments.   I can't even
> >> "grep" through a logfile of applications that were launched,
> >> based on what channel ID called them.  Oh well.
> >
> >You're not alone when you see this as a problem.  I'd also like to
> >selectively enable debugging for small bits of code.  The problem
> > is the changes are going to be extremely involved and will
> > generate a very large patch, when you consider every module.  The
> > other question to be answered is how granular we want this:  for
> > example, should the log level be determined only by module or
> > should there be multiple granularities within a module (i.e.
> > debugging PRI channels without debugging FXS channels)?  And
> > furthermore, should it be determined not only by module or
> > resource, but also by individual channel?  Each of these options
> > is going to incur an extra amount of work, though it makes the
> > ability to control logging much nicer (more specific).
>
> I was thinking about changing the logging functions to filter on a
> specific string. Something like debugInclude="pbx|sip"? Or exclude,
> or both?

Well, it's not a matter of syntax; it's a matter of each module
individually inheriting the global options from logger.conf, then
providing an API to add/remove certain options on request.

That reminds me; there's one more granular option:  since logger.conf
supports multiple files, that's another option that might be provided:
to turn on/off debugging for one file (such as the console) but not
another (like messages).  And we should probably use a stack to alter
these things on the fly... so we can do an alter, then do a restore to
previous state when we're done.

> I really felt it when I debugged my first app. I turned on
> debugging, since I wanted to see all my app's stuff. But then I'm
> flooded with messages from IAX, ZAP, PBX, etc.

You could do '#define DEBUG NOTICE' in the top of your file for
the time it takes you to do debugging, then remove it for production
use.  Not optimal, but it's one way to do it.

-- 
Tilghman



More information about the asterisk-dev mailing list