Re: [Log4cplus-devel] [log4cplus:bugs] #290 How to use log4cplus in android device
Logging Framework for C++
Brought to you by:
wilx
|
From: Václav Z. <vha...@gm...> - 2013-12-19 14:19:27
|
On 19 December 2013 14:56, Vladimir "Equidamoid" Shapranov
<equ...@gm...> wrote:
> Hi laiyierjiangsu,
>
> I'm using log4cplus in crossplatform android/ios app.
> The first option is to write your own appender. The simpliest one
> contains just one overridded method:
> > void LogcatAppender::append(const
> log4cplus::spi::InternalLoggingEvent &event){
> > log4cplus::tstring txt = formatEvent(event);
> > __android_log_write(ANDROID_LOG_WARN, "yourappname", txt.c_str());
> > }
> __android_log_write is defined in android/log.h header.
>
> Another way is to use SocketAppender class to send logs over wifi
> connection (I use my laptop as a receiver) and use loggingserver app to
> receive and read them.
>
> Also there is a possibility to redirect app's stdout to logcat (
> http://stackoverflow.com/questions/10531050/redirect-stdout-to-logcat-in-android-ndk
> ) but I haven't tried it.
Appender based on this logging API
(http://mobilepearls.com/labs/native-android-api/#logging) would be an
awesome addition to log4cplus.
>
> 19.12.2013 17:15 , laiyierjiangsu пишет:
>> ------------------------------------------------------------------------
>>
>> *[bugs:#290] <http://sourceforge.net/p/log4cplus/bugs/290/> How to use
>> log4cplus in android device*
>>
>> *Status:* open
>> *Labels:* android
>> *Created:* Thu Dec 19, 2013 01:15 PM UTC by laiyierjiangsu
>> *Last Updated:* Thu Dec 19, 2013 01:15 PM UTC
>> *Owner:* Václav Zeman
>>
>> I have integreted the log4cplus in my android application. Because I
>> am a newbie in android platform, i have some problems.
>>
>> In win32 platform , the fileappender will put the log file in the exe
>> directory ,but in the android virtual device , I can't find the log file.
>>
>> In win32 project ,the consoleappender will output the log to the
>> console ,but in the andriod application, the log didn't output in the
>> logcat window, it's puzzled me a lot .
>>
>> Can some one get into the same troble before? please help me.
--
VZ
|