# Define debug level only for one module/file?

**URL:** <https://community.asterisk.org/t/define-debug-level-only-for-one-module-file/95005>\
**Category:** Asterisk General\
**Created:** [December 6, 2022, 6:22pm UTC](https://community.asterisk.org/t/define-debug-level-only-for-one-module-file/95005 "2022-12-06T18:22:53Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![my\_asterisk](https://avatars.discourse-cdn.com/v4/letter/m/8edcca/32.png) [@my\_asterisk](https://community.asterisk.org/u/my_asterisk)\
**Post date:** [December 6, 2022, 6:22pm UTC](https://community.asterisk.org/t/define-debug-level-only-for-one-module-file/95005/1 "2022-12-06T18:22:53Z")

</div>

Hi guys!  
Recently we created an AEAP service for tts. It works fine. The problem is that our log grow very fast due to

DEBUG[1004] audiohook.c: Read factory 0x7fcf78062a88 and write factory 0x7fcf780634c8 both fail to provide 160 samples  
DEBUG[1004] audiohook.c: Write factory 0x7fcf780634c8 was pretty quick last time, waiting for them.

The problem is we cant just set the debug to 0, because there is a debug info that we need to have in our log:

DEBUG[375][C-0000000c] pbx\_variables.c: Function SPEECH\_TEXT(0) result is ‘01-02-2020’

is it somehow possible to turned off the debug for audiohook.c and keep it for pbx\_variables.c?  
Or just turned off the audiohook info?  
Thanks in advance!

---

<div class="post-metadata">

**Author:** ![jcolp](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/jcolp/32/8848_2.png) [@jcolp](https://community.asterisk.org/u/jcolp)\
**Post date:** [December 6, 2022, 6:24pm UTC](https://community.asterisk.org/t/define-debug-level-only-for-one-module-file/95005/2 "2022-12-06T18:24:10Z")

</div>

Why do you need that in the log…

---

<div class="post-metadata">

**Author:** ![my\_asterisk](https://avatars.discourse-cdn.com/v4/letter/m/8edcca/32.png) [@my\_asterisk](https://community.asterisk.org/u/my_asterisk)\
**Post date:** [December 6, 2022, 6:27pm UTC](https://community.asterisk.org/t/define-debug-level-only-for-one-module-file/95005/3 "2022-12-06T18:27:08Z")

</div>

Sometimes our clients have issues with the speech recognition, and Function SPEECH\_TEXT(0) result is ‘01-02-2020’ is the fastest way to check what asterisk get from our service.

---

<div class="post-metadata">

**Author:** ![jcolp](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/jcolp/32/8848_2.png) [@jcolp](https://community.asterisk.org/u/jcolp)\
**Post date:** [December 6, 2022, 6:28pm UTC](https://community.asterisk.org/t/define-debug-level-only-for-one-module-file/95005/4 "2022-12-06T18:28:27Z")

</div>

You could also use the Log dialplan application or Verbose to output a specific log message with that information.

---

<div class="post-metadata">

**Author:** ![jcolp](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/jcolp/32/8848_2.png) [@jcolp](https://community.asterisk.org/u/jcolp)\
**Post date:** [December 6, 2022, 6:29pm UTC](https://community.asterisk.org/t/define-debug-level-only-for-one-module-file/95005/5 "2022-12-06T18:29:17Z")

</div>

Or heck, use NoOp to have a dialplan execution message output.

The debug log isn’t really meant for this.

---

<div class="post-metadata">

**Author:** ![my\_asterisk](https://avatars.discourse-cdn.com/v4/letter/m/8edcca/32.png) [@my\_asterisk](https://community.asterisk.org/u/my_asterisk)\
**Post date:** [December 6, 2022, 8:34pm UTC](https://community.asterisk.org/t/define-debug-level-only-for-one-module-file/95005/6 "2022-12-06T20:34:30Z")

</div>

hi again.  
i have found that sometimes speechbackground returns “Function SPEECH\_TEXT(0) result is ‘(null)’”, but NoOP returns only empty string (s, 7, NoOp(result speechtext0 ${SPEECH\_TEXT(0)})) and we cant ignore the difference since for example (null) happens when the error occurred in our app, but the empty string is just one of the possible results.

Also there are some cases which easy to read with the debug.

So it would be great to just turn the audiohook off. Does asterisk have such option/settings?

---

<div class="post-metadata">

**Author:** ![InterLinked](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/interlinked/32/5576_2.png) [@InterLinked](https://community.asterisk.org/u/InterLinked)\
**Post date:** [December 7, 2022, 1:18pm UTC](https://community.asterisk.org/t/define-debug-level-only-for-one-module-file/95005/7 "2022-12-07T13:18:13Z")

</div>

To answer your direct question, `core set debug 0` then `core set debug 5 pbx_variables.c`, should do what you want (replace 5 with the desired debug level). You can enable debugging per module or core file this way.

---

<div class="post-metadata">

**Author:** ![my\_asterisk](https://avatars.discourse-cdn.com/v4/letter/m/8edcca/32.png) [@my\_asterisk](https://community.asterisk.org/u/my_asterisk)\
**Post date:** [December 8, 2022, 1:15pm UTC](https://community.asterisk.org/t/define-debug-level-only-for-one-module-file/95005/8 "2022-12-08T13:15:21Z")

</div>

Thanks for the answer! That what i was looking for. Is it possible to set this as an input parameter when we start asterisk or in asterisk.conf?

---

<div class="post-metadata">

**Author:** ![InterLinked](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/interlinked/32/5576_2.png) [@InterLinked](https://community.asterisk.org/u/InterLinked)\
**Post date:** [December 8, 2022, 1:28pm UTC](https://community.asterisk.org/t/define-debug-level-only-for-one-module-file/95005/9 "2022-12-08T13:28:33Z")

</div>

asterisk.conf allows you to set the global debug level, which isn’t what you want here.

I think the best way might be in cli.conf, just add:

`core set debug 5 pbx_variables.c = yes`

---

<div class="post-metadata">

**Author:** ![my\_asterisk](https://avatars.discourse-cdn.com/v4/letter/m/8edcca/32.png) [@my\_asterisk](https://community.asterisk.org/u/my_asterisk)\
**Post date:** [December 8, 2022, 1:34pm UTC](https://community.asterisk.org/t/define-debug-level-only-for-one-module-file/95005/10 "2022-12-08T13:34:50Z")

</div>

Thanks for the fast reply! Will try it.

---

<div class="post-metadata">

**Author:** ![my\_asterisk](https://avatars.discourse-cdn.com/v4/letter/m/8edcca/32.png) [@my\_asterisk](https://community.asterisk.org/u/my_asterisk)\
**Post date:** [December 8, 2022, 6:42pm UTC](https://community.asterisk.org/t/define-debug-level-only-for-one-module-file/95005/11 "2022-12-08T18:42:12Z")

</div>

Another question :  
i have --ddv as a start param  
in asterisk.conf debug level is set to 2  
but when i open cli it says Core debug is still 4. Is it possible that something overwrites the debug settings somewhere?

One more:  
Is there a command which shows the debug settings, for example, audiohook.c has 0 debug level, pbx\_variables.c has 4, etc. Core show settings - doesnt show debug settings.

---

<div class="post-metadata">

**Author:** ![InterLinked](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/interlinked/32/5576_2.png) [@InterLinked](https://community.asterisk.org/u/InterLinked)\
**Post date:** [December 8, 2022, 8:50pm UTC](https://community.asterisk.org/t/define-debug-level-only-for-one-module-file/95005/12 "2022-12-08T20:50:54Z")

</div>

You would want to do both in your case, yes, since it sounds like your default debug level is not 0.  
Alternately in asterisk.conf, set debug = 0.

I don’t think such a command currently exists.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/asterisk/original/2X/4/475d0c889911cfb84ac4881ad6df8b523e3f9105.png) [@system](https://community.asterisk.org/u/system)\
**Post date:** [January 7, 2023, 8:51pm UTC](https://community.asterisk.org/t/define-debug-level-only-for-one-module-file/95005/13 "2023-01-07T20:51:25Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
