Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get Verbose logging in logcat for a specific module

One of the android Modules (AudioFlinger) has support for verbose logging (with Tag=AudioFlinger). Question is how can I see those logs in the logcat?

I did the setprop log.tag.AudioFlinger VERBOSE - but it doesn't seem to work. Do I need to change something and then rebuild the android source again?

like image 992
KurtCobain Avatar asked Nov 01 '11 09:11

KurtCobain


People also ask

What is verbose Logcat?

Logcat is a command-line tool that dumps a log of system messages, including stack traces when the device throws an error and messages that you have written from your app with the Log class. This page is about the command-line logcat tool, but you can also view log messages from the Logcat window in Android Studio.

What is verbose debug logging?

Verbose logging is a type of computer logging method that involves more information than the standard or typical logging process. Typically, users can turn on verbose logging features to get more information about a system.

How do I view the logs in logcat?

By default, logcat displays just the log messages for your app running on the device. To change this default, see how to filter logcat messages. The Logcat toolbar provides the following buttons: Clear logcat : Click to clear the visible log. Scroll to the end : Click to jump to the bottom of the log and see the latest log messages.

What is the use of logcat?

Logcat is a command-line tool that dumps a log of system messages, including stack traces when the device throws an error and messages that you have written from your app with the Log class.

What is logcat command in Android Studio?

Logcat is a command-line tool that dumps a log of system messages, including stack traces when the device throws an error and messages that you have written from your app with the Log class. This page is about the command-line logcat tool, but you can also view log messages from the Logcat window in Android Studio.

How do I run logcat on an emulator?

You can run logcat as an adb command or directly in a shell prompt of your emulator or connected device. To view log output using adb, navigate to your SDK platform-tools/ directory and execute: For logcat online help, start a device and then execute: The following table describes the command line options of logcat.


2 Answers

Use any of the below methods.

1) Add or uncomment "`#define LOG_NDEBUG 0`" at top of any module file.
2) In Android.mk or <module>.mk file, add `LOCAL_CFLAGS += -DLOG_NDEBUG=0`

In logcat, logcat | grep -E 'tag1|tag2'.
like image 65
SD. Avatar answered Sep 19 '22 13:09

SD.


The logcat documentation doesn't really help. But with more digging I was able to find the answer, as I was expecting the VERBOSE logging is by default OFF at compile time.

Looking at the cutils/log.h helps to find the answer: http://www.netmite.com/android/mydroid/system/core/include/cutils/log.h

/*
 * Normally we strip LOGV (VERBOSE messages) from release builds.
 * You can modify this (for example with "#define LOG_NDEBUG 0"
 * at the top of your source file) to change that behavior.
 */

So to enable VERBOSE for any source file/module : We have to define LOG_NDEBUG as 0

like image 21
KurtCobain Avatar answered Sep 16 '22 13:09

KurtCobain