Re: [pjsip] PJSUA: how to deal with verbosity?

SF
Skale Franz
Wed, Feb 19, 2020 1:40 PM

Hi,
you've to carefully read the docs then.
You can control the logging via callbacks as i did.
First i set defaults: (in my app).
Snippet:

pj_log_set_level(0);
/* Create pjsua first! /
status = pjsua_create();
app_config.log_cfg.cb = &log_cb;
app_config.log_cfg.level = 3; /
default log level 3 ! */
app_config.log_cfg.console_level = 3;

Callback: (do, whatever you want to do with the logs ! (e.g. i'm wirting all to STDERR !)

void log_cb(int level, const char *data, int len) {
PJ_UNUSED_ARG(level);

/* Only to to stderr if no logfile was given at the command line ! */
if ( app_config.log_cfg.log_filename.slen == 0)
fwrite(data, len, 1, stderr);
}

Best regards
Franz


Von: Ogogon !!! ogogon@ogogon.org
Gesendet: Mittwoch, 19. Februar 2020 13:41
An: Skale Franz
Betreff: Re: [pjsip] PJSUA: how to deal with verbosity?

19.02.20 15:18, Skale Franz wrote:

Hi,
ran across the same problem.
My solution (including my comment ;-))
Of course, you've to add the following line before calling pjsua_start !

/* Some kind of a hack. For some reason the pjlib initialization
* logging doesn't use the app_config.log_cfg callback facility ...
* even when it has been defined ;-) */
pj_log_set_level(0);

Thank you for responding to my question.
However, unfortunately, this did not work.

I inserted this line. Now this piece of code looks like this:

 pj_log_set_level (0);

 /* Initialization is done, now start pjsua */
 status = pjsua_start ();
 if (status != PJ_SUCCESS)
       error_exit ("Error starting pjsua", status);

Further, everything is as before. The application works, but writes full
debugging to the screen.

ogogon@ot:/usr/local/src/sipcc# ./sipcc

.oooooo..o ooooo ooooooooo.                      SIP console client.
d8P'    Y8 888' 888 Y88.
Y88bo.      888  888  .d88'  .ooooo.  .ooooo.
"Y8888o. 888 888ooo88P' d88' "Y8 d88' "Y8. "Y88b  888  888        888      888 v.0.2.0.a2
oo    .d8P  888  888        888  .o8 888  .o8
8""88888P' o888o o888o        Y8bod8P' Y8bod8P'

X<           |||        `  ___  ' ,,,,,        ,,,,,

 (o o)         (o o)      -  (O o)  -     /(o o)\       /(o o)\

ooO--()--Ooo-ooO--()--Ooo-ooO--()--Ooo-ooO--()--Ooo-ooO--(_)--Ooo-

15:29:58.295                critsec !Mutex created
15:29:58.295                critsec !Mutex: thread thr0x805616000 is
waiting
15:29:58.295                critsec  Mutex acquired by thread
thr0x805616000
15:29:58.295                critsec  Mutex released by thread
thr0x805616000
15:29:58.295                critsec  Mutex: thread thr0x805616000 is
waiting
15:29:58.295                critsec  Mutex acquired by thread
thr0x805616000
15:29:58.295                critsec  Mutex released by thread
thr0x805616000
15:29:58.295        os_core_unix.c  pjlib 2.9 for POSIX initialized
15:29:58.298            cachingpool  .pool created, size=512
15:29:58.298            cachingpool  .Mutex created
15:29:58.298            cachingpool  .Mutex: thread thr0x805616000 is
waiting
15:29:58.298            cachingpool  .Mutex acquired by thread
thr0x805616000
15:29:58.298                  pjsua  .pool created, size=1024
15:29:58.298            cachingpool  .Mutex released by thread
thr0x805616000
15:29:58.298                  pjsua  .Mutex created
15:29:58.298        sip_endpoint.c  .Creating endpoint instance...
15:29:58.298            cachingpool  .Mutex: thread thr0x805616000 is
waiting
15:29:58.298            cachingpool  .Mutex acquired by thread
thr0x805616000
15:29:58.298        pept0x80561e000  .pool created, size=4096
15:29:58.298            cachingpool  .Mutex released by thread
thr0x805616000
15:29:58.298                critsec  .Mutex: thread thr0x805616000 is
waiting
15:29:58.298                critsec  .Mutex acquired by thread
thr0x805616000
15:29:58.298                critsec  .Mutex: thread thr0x805616000 is
waiting
15:29:58.298                critsec  .Mutex acquired by thread
thr0x805616000
15:29:58.298                critsec  .Mutex released by thread
thr0x805616000
15:29:58.298                critsec  .Mutex: thread thr0x805616000 is
waiting

...

Maybe there is something with the visibility of variables? I don’t
really like that this function does not contain a pointer to any
structure containing data about the stack.

Best regards
Franz

Ogogon.

Hi, you've to carefully read the docs then. You can control the logging via callbacks as i did. First i set defaults: (in my app). Snippet: pj_log_set_level(0); /* Create pjsua first! */ status = pjsua_create(); app_config.log_cfg.cb = &log_cb; app_config.log_cfg.level = 3; /* default log level 3 ! */ app_config.log_cfg.console_level = 3; Callback: (do, whatever you want to do with the logs ! (e.g. i'm wirting all to STDERR !) void log_cb(int level, const char *data, int len) { PJ_UNUSED_ARG(level); /* Only to to stderr if no logfile was given at the command line ! */ if ( app_config.log_cfg.log_filename.slen == 0) fwrite(data, len, 1, stderr); } Best regards Franz ________________________________________ Von: Ogogon !!! <ogogon@ogogon.org> Gesendet: Mittwoch, 19. Februar 2020 13:41 An: Skale Franz Betreff: Re: [pjsip] PJSUA: how to deal with verbosity? 19.02.20 15:18, Skale Franz wrote: > Hi, > ran across the same problem. > My solution (including my comment ;-)) > Of course, you've to add the following line before calling pjsua_start ! > > /* Some kind of a hack. For some reason the pjlib initialization > * logging doesn't use the app_config.log_cfg callback facility ... > * even when it has been defined ;-) */ > pj_log_set_level(0); Thank you for responding to my question. However, unfortunately, this did not work. I inserted this line. Now this piece of code looks like this: > > pj_log_set_level (0); > > /* Initialization is done, now start pjsua */ > status = pjsua_start (); > if (status != PJ_SUCCESS) > error_exit ("Error starting pjsua", status); Further, everything is as before. The application works, but writes full debugging to the screen. > ogogon@ot:/usr/local/src/sipcc# ./sipcc > > .oooooo..o ooooo ooooooooo. SIP console client. > d8P' `Y8 `888' `888 `Y88. > Y88bo. 888 888 .d88' .ooooo. .ooooo. > `"Y8888o. 888 888ooo88P' d88' `"Y8 d88' `"Y8. > `"Y88b 888 888 888 888 v.0.2.0.a2 > oo .d8P 888 888 888 .o8 888 .o8 > 8""88888P' o888o o888o `Y8bod8P' `Y8bod8P' > > >X<           |||        `  ___ ' ,,,,, ,,,,, > (o o) (o o) - (O o) - /(o o)\ /(o o)\ > ooO--(_)--Ooo-ooO--(_)--Ooo-ooO--(_)--Ooo-ooO--(_)--Ooo-ooO--(_)--Ooo- > > 15:29:58.295 critsec !Mutex created > 15:29:58.295 critsec !Mutex: thread thr0x805616000 is > waiting > 15:29:58.295 critsec Mutex acquired by thread > thr0x805616000 > 15:29:58.295 critsec Mutex released by thread > thr0x805616000 > 15:29:58.295 critsec Mutex: thread thr0x805616000 is > waiting > 15:29:58.295 critsec Mutex acquired by thread > thr0x805616000 > 15:29:58.295 critsec Mutex released by thread > thr0x805616000 > 15:29:58.295 os_core_unix.c pjlib 2.9 for POSIX initialized > 15:29:58.298 cachingpool .pool created, size=512 > 15:29:58.298 cachingpool .Mutex created > 15:29:58.298 cachingpool .Mutex: thread thr0x805616000 is > waiting > 15:29:58.298 cachingpool .Mutex acquired by thread > thr0x805616000 > 15:29:58.298 pjsua .pool created, size=1024 > 15:29:58.298 cachingpool .Mutex released by thread > thr0x805616000 > 15:29:58.298 pjsua .Mutex created > 15:29:58.298 sip_endpoint.c .Creating endpoint instance... > 15:29:58.298 cachingpool .Mutex: thread thr0x805616000 is > waiting > 15:29:58.298 cachingpool .Mutex acquired by thread > thr0x805616000 > 15:29:58.298 pept0x80561e000 .pool created, size=4096 > 15:29:58.298 cachingpool .Mutex released by thread > thr0x805616000 > 15:29:58.298 critsec .Mutex: thread thr0x805616000 is > waiting > 15:29:58.298 critsec .Mutex acquired by thread > thr0x805616000 > 15:29:58.298 critsec .Mutex: thread thr0x805616000 is > waiting > 15:29:58.298 critsec .Mutex acquired by thread > thr0x805616000 > 15:29:58.298 critsec .Mutex released by thread > thr0x805616000 > 15:29:58.298 critsec .Mutex: thread thr0x805616000 is > waiting ... Maybe there is something with the visibility of variables? I don’t really like that this function does not contain a pointer to any structure containing data about the stack. > Best regards > Franz Ogogon.
O!
Ogogon !!!
Wed, Feb 19, 2020 3:49 PM

19.02.20 16:40, Skale Franz wrote:

Hi,
you've to carefully read the docs then.

Thanks a lot!

In the documentation was caught the function pj_log_set_level(), and it
helped in the most decisive way.
This function, in all evidence, affects the situation.

    /* Create pjsua first! */
    pj_log_set_level(3);

    status = pjsua_create();
    if (status != PJ_SUCCESS)
        error_exit ("Error in pjsua_create()", status);

The world again becomes understandable and manageable, which means that
I can work with it and improve it!

ogogon@ot:/usr/local/src/sipcc# ./sipcc

 .oooooo..o ooooo ooooooooo.                       SIP console client.
d8P'    Y8 888' 888   Y88.
Y88bo.       888   888   .d88'  .ooooo.   .ooooo.
 "Y8888o.   888   888ooo88P'  d88' "Y8 d88' "Y8.      "Y88b  888   888         888       888 v.0.2.0.a2
oo     .d8P  888   888         888   .o8 888   .o8
 8""88888P' o888o o888o        Y8bod8P' Y8bod8P'

     >X<           |||        `  ___  ' ,,,,,         ,,,,,
    (o o)         (o o)      -  (O o)  -     /(o o)\       /(o o)
ooO--()--Ooo-ooO--()--Ooo-ooO--()--Ooo-ooO--()--Ooo-ooO--(_)--Ooo-

warning: discarded first playback frame
warning: discarded first playback frame
SIPcc# warning: Auto-filling the buffer (your application is buggy
and/or got xruns)

SIPcc# call sip:ogogon@ogogon.org
SIPcc# hang
SIPcc# quit
ogogon@ot:/usr/local/src/sipcc#

Ogogon.

19.02.20 16:40, Skale Franz wrote: > Hi, > you've to carefully read the docs then. Thanks a lot! In the documentation was caught the function pj_log_set_level(), and it helped in the most decisive way. This function, in all evidence, affects the situation. >     /* Create pjsua first! */ >     pj_log_set_level(3); > >     status = pjsua_create(); >     if (status != PJ_SUCCESS) >         error_exit ("Error in pjsua_create()", status); The world again becomes understandable and manageable, which means that I can work with it and improve it! > ogogon@ot:/usr/local/src/sipcc# ./sipcc > >  .oooooo..o ooooo ooooooooo.                       SIP console client. > d8P'    `Y8 `888' `888   `Y88. > Y88bo.       888   888   .d88'  .ooooo.   .ooooo. >  `"Y8888o.   888   888ooo88P'  d88' `"Y8 d88' `"Y8. >      `"Y88b  888   888         888       888 v.0.2.0.a2 > oo     .d8P  888   888         888   .o8 888   .o8 >  8""88888P' o888o o888o        `Y8bod8P' `Y8bod8P' > >      >X<           |||        `  ___  ' ,,,,,         ,,,,, >     (o o)         (o o)      -  (O o)  -     /(o o)\       /(o o)\ > ooO--(_)--Ooo-ooO--(_)--Ooo-ooO--(_)--Ooo-ooO--(_)--Ooo-ooO--(_)--Ooo- > > warning: discarded first playback frame > warning: discarded first playback frame > SIPcc# warning: Auto-filling the buffer (your application is buggy > and/or got xruns) > > SIPcc# call sip:ogogon@ogogon.org > SIPcc# hang > SIPcc# quit > ogogon@ot:/usr/local/src/sipcc# Ogogon.