Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to print log messages with in Android framework

I am trying to print log messages within core Android framework files. For example, I tried logging messages within MediaRecorderClient.cpp under frameworks\base\media\libmediaplayerservice\. I've tried LOGV, LOGE, LOGD, printf, and __android_log_print, without any success.

Which command should I use to print log messages?

like image 986
Eric Lin Avatar asked Dec 27 '22 10:12

Eric Lin


2 Answers

Log should be used, but it will print to logcat not system print.

Example:

Log.d("filter", example text); // filter is any tag you want to use as filter

You can open logcat in eclipse from window-show view -> other -> android -> logcat

like image 166
Warpzit Avatar answered Dec 30 '22 09:12

Warpzit


What kind of error do you receive? If it does not compile, make sure you've included <android/log.h>, also in Android.mk:

LOCAL_LDLIBS := -llog

If it compiles but does not produce any output, then, like @Warpzit has said, you have to look at logcat to see your messages.

like image 30
trashkalmar Avatar answered Dec 30 '22 09:12

trashkalmar