[SR-Users] Using a specific log level for "script" ?

Daniel-Constantin Mierla miconda at gmail.com
Mon Jan 4 08:08:25 CET 2021


The first parameter of xlog() can be a variable, like $shv(...) or
$sht(...), which can be changed at runtime via RPC commands, so you can
tune the log level as you need.

The debugger module was designed to control the log messages from the C
code.

The "script" prefix for cfg log messages can be also changed via xlog
modparam.

Cheers,
Daniel

On 31.12.20 17:47, Chaigneau, Nicolas wrote:
>
> Thanks Daniel for the explaination !
>
>  
>
> I found something in a Kamailio sample script that does what I want to
> do, e.g. :
>
>  
>
> #!ifdef WITH_DEBUG_SCRIPT
>
>                                xlog("L_INFO", "Request-URI: $ru\n");
>
> #!endif
>
>  
>
>  
>
> This allows me to log « debug » information from the script as INFO
> when the flag WITH_DEBUG_SCRIPT is set.
>
> It’s a bit clumsy but it works. :)
>
>  
>
> (I don’t know if having the xlog exported functions changed so they go
> look at the configuration of the debugger module would be complicated,
> or even feasible – would be nice though ! ^^)
>
>  
>
>  
>
> Cheers!
>
> Nicolas.
>
>  
>
> *De :*Daniel-Constantin Mierla <miconda at gmail.com>
> *Envoyé :* jeudi 31 décembre 2020 14:04
>
> Hello,
>
> the log messages that have "script" in the prefix are from
> kamailio.cfg routing blocks, not from the C code.
>
> You can remove, change their log level, ... by editing the
> kamailio.cfg. The script log messages are printed by the functions
> exported from xlog module.
>
> Cheers,
> Daniel
>
> On 30.12.20 18:14, Chaigneau, Nicolas wrote:
>
>     Hello,
>
>      
>
>      
>
>     Is it possible to set a specific log level for the Kamailio script ?
>
>     I’ve seen that the « debugger » module allows to do that with
>     modules or « core » :
>
>      
>
>     https://kamailio.org/docs/modules/5.4.x/modules/debugger.html#dbg.p.mod_level
>     <https://kamailio.org/docs/modules/5.4.x/modules/debugger.html#dbg.p.mod_level>
>
>      
>
>      
>
>     So I’ve tried to do :
>
>      
>
>     modparam("debugger", "mod_level_mode", 1)
>
>     modparam("debugger", "mod_hash_size", 5)
>
>     modparam("debugger", "mod_level", "my_module=3") // this works
>
>     modparam("debugger", "mod_level", "core=3") // also works
>
>     modparam("debugger", "mod_level", "script=3") // nope…
>
>      
>
>      
>
>     But it doesn’t seem to work for « script »… :/
>
>      
>
>      
>
>     Regards,
>
>     Nicolas.
>
>      
>
> This message contains information that may be privileged or
> confidential and is the property of the Capgemini Group. It is
> intended only for the person to whom it is addressed. If you are not
> the intended recipient, you are not authorized to read, print, retain,
> copy, disseminate, distribute, or use this message or any part
> thereof. If you receive this message in error, please notify the
> sender immediately and delete all copies of this message. 

-- 
Daniel-Constantin Mierla -- www.asipto.com
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Funding: https://www.paypal.me/dcmierla

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20210104/80d0a37f/attachment.htm>


More information about the sr-users mailing list