Another ways to put logs in native

The is one more simple way to put logs in native library of android. You have to following the methon as explained below.

1) First of all check weather you your lib is linking with libutils and libcutils if not just add these flags in   LOCAL_SHARED_LIBRARIES  in   your library’s Android.mk

2) Now  include #include <utils/Log.h> header file.

3) Define LOG_TAG micro with some value. You can use this value to filter logs in logcat.

  #undef LOG_TAG

#define LOG_TAG “YS”

3) After this you can use below mero functions to put logs LOGV, LOGI, LOGW, LOGF, LOGS.

for example LOGV(“This is my log statement on line %d”,__LINE__);

 

I hope this method of putting logs is more easy and simple .

Advertisements
This entry was posted in Debugging Native Libary and tagged , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s