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.
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.
>
> ------------------------------------------------------------------------
>
> Sent from sourceforge.net because
> log...@li... is subscribed to
> https://sourceforge.net/p/log4cplus/bugs/
>
> To unsubscribe from further messages, a project admin can change
> settings at https://sourceforge.net/p/log4cplus/admin/bugs/options.
> Or, if this is a mailing list, you can unsubscribe from the mailing list.
>
>
>
> ------------------------------------------------------------------------------
> Rapidly troubleshoot problems before they affect your business. Most IT
> organizations don't have a clear picture of how application performance
> affects their revenue. With AppDynamics, you get 100% visibility into your
> Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
> http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
>
>
> _______________________________________________
> Log4cplus-devel mailing list
> Log...@li...
> https://lists.sourceforge.net/lists/listinfo/log4cplus-devel
--
Best regards,
Vladimir
|