Re: PJSUA: how to deal with verbosity?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
Gesendet: Mittwoch, 19. Februar 2020 13:41
An: Skale Franz
Betreff: Re:  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.


_______________________________________________
Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip@xxxxxxxxxxxxxxx
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org




[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux