Android: Compile pjsip libs with log

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

 



Here you go:

EpConfig *ep_cfg = new EpConfig();

// do stuff

// use custom writer
ep_cfg->logConfig.writer = new CustomLogWriter(this);

And then in CustomLogWriter (which of course inhereits from LogWriter)
you must implement the write function to add the desired behavior:

void CustomLogWriter::write(const LogEntry &entry) {

    // do the stuff you want
    entry.level;
    entry.msg;
    entry.threadId;
    entry.threadName;

}

(Please note that this is C++ implementation, but Java/Python
implementations should be equivalent)


2016-02-18 12:30 GMT+01:00 deepak Padhy <dpkpadhy6 at gmail.com>:

> Thanks for sharing the info , its really helpful as i am also stuck for
> getting the android logs through logcat.
>
> Can you please share the piece of code or some more information about how
> i can override the default Logwriter.
>
> I followed the procedure shared in previous mails, bt i only can see very
> few pjsip stack logs even if the log level set  is 6.
>
> Please share some suggestion.
> On 18 Feb 2016 15:15, "Andres Perez" <anpelo6 at gmail.com> wrote:
>
>> I finally solved the question.
>> The way to do it is to override LogWriter class and implement custom
>> behavior on the write method.
>> Then you specify EpConfig->LogConfig to use your new writer instead of
>> the default writer.
>>
>> Andr?s
>>
>> 2016-02-17 10:59 GMT+01:00 Andres Perez <anpelo6 at gmail.com>:
>>
>>>
>>>
>>> 2016-02-17 8:21 GMT+01:00 Shaul Kedem <shaul at yallo.com>:
>>>
>>>> try writing to /sdcard/ on android
>>>>
>>>> Thanks! following code works (although not in every device, not sure
>>> why)
>>>
>>> ep_cfg->logConfig.filename = "/sdcard/logconfig";
>>>
>>>
>>> However, having a log file is nice, but I still would not be able to get
>>> log messages through LogCat, which was my main question.
>>>
>>> Do you have maybe any further suggestions?
>>>
>>> Thanks,
>>>
>>> Andr?s
>>>
>>>
>>>> On 16 Feb 2016, at 5:33 PM, Andres Perez <anpelo6 at gmail.com> wrote:
>>>>
>>>>
>>>> 2016-02-16 15:14 GMT+01:00 Shaul Kedem <shaul at yallo.com>:
>>>>
>>>>> What do you put in pjsua_logging_config ? do you pass it on to init ?
>>>>>
>>>>> I am not using plain pjsip libraries, but pjsua2 abstraction.
>>>> In that sense, my init configuration code is like following.
>>>>
>>>> try {
>>>>         EpConfig *ep_cfg;
>>>>         ep_cfg = new EpConfig();
>>>>
>>>>         ep_cfg->logConfig.msgLogging=1;
>>>>         ep_cfg->logConfig.consoleLevel=5;
>>>>         ep_cfg->logConfig.level = 5;
>>>> //      ep_cfg->logConfig.filename = "THE.LOG"; // this line makes app to crash, probably because of write permissions
>>>>         ep->libInit(*ep_cfg);
>>>> } catch(Error& err) {
>>>>         // ...
>>>> }
>>>>
>>>> which is similar to the examples given, e.g. in
>>>> pjsip-apps/src/samples/pjsua2_demp.cpp
>>>>
>>>>
>>>>
>>>>> On 16 Feb 2016, at 4:00 PM, Andres Perez <anpelo6 at gmail.com> wrote:
>>>>>
>>>>> Hi,
>>>>>
>>>>> I want to use pjsip for an android  VoIP application.
>>>>> I am using native functions to call libpjsua2.so methods. libpjsua2
>>>>> was obtained in the way described in Getting-Started/Android: first
>>>>> building all pj* folders to obtain libpj*.a, and then running /pjsip-apps/src/swig/make
>>>>> to build libpjsua2 and swig bindings (which I don't use anyway).
>>>>>
>>>>> I am unable to get any log message through LogCat. I am working with
>>>>> Android Studio 1.5, gradle experimental 0.2.0.
>>>>>
>>>>> In the android documentation, under "Debugging native code with
>>>>> Eclipse", it is advised to use the compiler flag CFLAGS += -g (for
>>>>> example by adding it to user.mak when building static libraries).
>>>>> I have followed that point, but I think it is even not necessary,
>>>>> since in the output of ./configure-android says CFLAGS =  -fpic
>>>>> -ffunction-sections -funwind-tables -no-canonical-prefixes -march=armv7-a
>>>>> -mfpu=vfpv3-d16 -mfloat-abi=softfp -mthumb -Os -g (...) by default.
>>>>>
>>>>> I think that I'm having some kind of issue with libs compilation that
>>>>> does not configure logs properly, but I could not find any further
>>>>> documentation.
>>>>>
>>>>> Thank you for your attention.
>>>>>
>>>>> Best,
>>>>>
>>>>> Andr?s
>>>>>
>>>>> --
>>>>> *\A/*
>>>>> _______________________________________________
>>>>> Visit our blog: http://blog.pjsip.org
>>>>>
>>>>> pjsip mailing list
>>>>> pjsip at lists.pjsip.org
>>>>> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Visit our blog: http://blog.pjsip.org
>>>>>
>>>>> pjsip mailing list
>>>>> pjsip at lists.pjsip.org
>>>>> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> *\A/*
>>>> _______________________________________________
>>>> Visit our blog: http://blog.pjsip.org
>>>>
>>>> pjsip mailing list
>>>> pjsip at lists.pjsip.org
>>>> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Visit our blog: http://blog.pjsip.org
>>>>
>>>> pjsip mailing list
>>>> pjsip at lists.pjsip.org
>>>> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
>>>>
>>>>
>>>
>>>
>>> --
>>> *\A/*
>>>
>>
>>
>>
>> --
>> *\A/*
>>
>> _______________________________________________
>> Visit our blog: http://blog.pjsip.org
>>
>> pjsip mailing list
>> pjsip at lists.pjsip.org
>> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
>>
>>
> _______________________________________________
> Visit our blog: http://blog.pjsip.org
>
> pjsip mailing list
> pjsip at lists.pjsip.org
> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
>
>


-- 
*\A/*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20160218/1143be6e/attachment.html>


[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