Showing posts with label logs. Show all posts
Showing posts with label logs. Show all posts

Sunday, October 14, 2012


How to display logs from android service:

By default,If we added any android service in init.rc, logs are redirected to null device. So logs wont be shown from service. Sometimes it will show sometimes it wont show logs. To display logs always from service,


we have to do the following

service serviceName /system/bin/logwrapper /system/bin/dhcpcd -BKLA -d eth0
disabled
oneshot

/system/bin/logwrapper - this will redirect the  service logs to logcat.

init.rc script is executed by init process.

Thursday, October 04, 2012

To Enable logs in android Java files:   

import android.util.Slog;
 private void log(String s) {
        Slog.d(TAG, s);
    }
Another way of adding NDK logs in C/C++:

#include
LOCAL_LDLIBS := -llog

void LOGI(char *szMsg)
{
__android_log_write(ANDROID_LOG_ERROR,"Tag",szMsg);
}