Search code examples
androidloggingandroid-ndklog4cxx

LOG4CXX to Android Log


How can I easily replace the log4cxx for android log?

I'm trying to re-define as:

#define LOG4CXX_INFO(logger, message) __android_log_print(ANDROID_LOG_INFO, LOG_TAG, message)

But a compilation error is showed:

xxxxx.cpp:122:13: error: no match for 'operator<<' in '"Could not open file " << fileName'

Solution

  • It is best to write a custom Appender wrapping __android_log_print.

    See Log4cxx custom appender.