SlideShare a Scribd company logo
1 of 29
Download to read offline
Anroid Logging System
William.L
wiliwe@gmail.com
Date: 2011-07-21
Outline
Overview of Android Loggin System
Log from Java program
Log from Native C/C++ program
How to read log?
Tips
Overview of Android
Logging System
What is Android Logging System?
Provide a mechanism for collecting and viewing
system debug output
Logs from various applications and portions of
the system are collected in a series of circular
buffers, which then can be viewed and filtered by
the logcat command
Overview of Logging System
[Android Device]
[HOST/PC]
USB
cable
Introduction
The logging system consists of
A kernel driver and kernel buffers for storing log messages
HoneycombMR2Src/kernel/drivers/staging/android/logger.c
Create “/dev/log” folder in handle_device_event() of
AndroidSrc/system/core/init/devices.c
C/C++/Java APIs and classes
For making log messages
For accessing the log messages
logcat, the command for viewing log messages
AndroidSrc/system/core/logcat/
Ability to view and filter the log messages from the host
machine (via Eclipse-ADT or DDMS)
Log device files
4 channels, each have a Ring/Circular Buffer
/dev/log/radio – radio&phone-related messages (64KB)
/dev/log/events – system/hardware events (256KB)
/dev/log/system –framwork or low-level system messages
(64KB)
/dev/log/main – everything else (64KB)
The maximum log message size of each channel is specified in
kernel driver(logger.c)
File permission of each(radio/events/system/main) is
0662 (rw-rw-w)
owner/group RW,
other Write only
owner=root, group=log
Anyone can Write logs, root or log group can Read them
Android Debug Bridge
ADB client
Runs on your development machine(Host).
You can invoke a client from a shell by issuing an “adb”
command.
Other Android tools such as the ADT plugin and DDMS also
create adb clients.
ADB server (adbserver)
Runs on your development machine(Host).
The server manages communication between the client and the
adb daemon running on an emulator or device.
ADB daemon (adbd)
Runs on each Android emulator or Android device instance.
Log from Java program
Classes used for Logging
android.util.Log class
System.out / System.err
android.util.Log
Static methods
AndroidSrc/frameworks/base/core/java/android/util/Log.
java
Error messageLog.e (String tag, String msg)
Warrning messageLog.w (String tag, String msg)
Info messageLog.i (String tag, String msg)
Debugging messageLog.d (String tag, String msg)
Verbose messageLog.v (String tag, String msg)
Example :
/* In Java code, add the following codes */
import android.util.Log;
class CCLLAASS {
static String TAG=“tagName”;
public MethodXX() {
Log.v(TAG, “Debugging messages you want”);
}
}
System.out / System.err (1/2)
System.out/System.err output to Android log
zygoteInit() {
System.setOut(AndroidPrintStream);
System.setErr(AndroidPrintStream); }
AndroidSrc/frameworks/base/core/java/com/android/internal/o
s/RuntimeInit.java
com.android.internal.os.AndroidPrintStream (which derives
from LoggingPrintStream which derives from
PrintStream)
AndroidSrc/frameworks/base/core/java/com/android/internal/o
s/AndroidPrintStream.java
System.out / System.err (2/2)
How to identify instance of System.out/System.err?
System.out.println(”System.out=”+System.out.toString())
System.err.println(”System.err=”+System.err.toString())
Example :
/* Add the System.out and System.err statements in the constructor of MountService.java */
class MountService {
MountService() {
….
System.out.println(”System.out’s instance is ”+System.out.toString());
System.err.println(”System.err’s instance is ”+System.err.toString());
….
}
}
Log from Native C/C++
program
Library for Logging
Use liblog library
Include <android/log.h> header
<cutils/log.h>(libcutils) header could be used
This header includes <android/log.h> eventually
__android_log_print macro(defined in liblog) is the
actual worker behind LOGI[V/D/W/E] functions
Example :
#define LOGI(...) 
__android_log_print (ANDROID_LOG_INFO,LOG_TAG,__VA_ARGS__)
Usage :
LOGI(”i=%d, name=%sn”, i, name);
Log From Native Program (1/2)
Log functions
Error messageLOGE (String msg)
Warrning messageLOGW (String msg)
Info messageLOGI (String msg)
Debugging messageLOGD (String msg)
Verbose message.LOGV (String msg)
Example :
/* In C/C++ code, add the following codes*/
#define LOG_TAG “tagName”
#include <cutils/log.h>
LOGV(“Debugging messages you want”);
Log From Native Program (2/2)
It must add following definition BEFORE the header
"#include <cutils/log.h>"
#undef NDEBUG : Enable LOGV/LOGI/LOGD
#define LOG_NDEBUG 0 : Enable LOGV
#define LOG_NIDEBUG 0 : Enable LOGI
#define LOG_NDDEBUG 0 : Enable LOGD
#define LOG_TAG “String-You-Want"
Because all the above are defined in <cutils/log.h>,
if the define is put after the header including
statment, it will show “redefined” compile warning
and define will not take effect
How to read log?
Logcat Command
“logcat” command runs on Android device
Use the command to run ‘logcat’ command on
the remote Android device : “adb shell logcat”
ADB Logcat
Command : adb logcat
Logcat pane in ADT, Eclipse
Tips
Dumping stack trace
logwrapper
Log at ‘init’ process
Support Non built-in ADB USB VID
Dumping stack trace (1/2)
3 arguments methods in android.util.Log class
Ex: Log.e(String tag, String msg, new Throwable())
Throwable.printStacktrace() also works
Dump to System.err
Dumping stack trace (2/2)
Example for Throwable.printStackTrace (MountService.java) :
class MountService extends IMountService.Stub implements INativeDaemonConnectorCallbacks
{
public static void NewException() throws Throwable
{
throw new Throwable("New Exception...");
}
public MountSerivce(Context context) {
…
try {
NewException();
} catch (Throwable e) {
// Prints this throwable and its backtrace to the
// standard error stream.
e.printStackTrace();
}
...
}
…
}
logwrapper
Redirects stdout(like printf)/stderr to Android
Logging system
Usage
“logwrapper Executable”, and use “logcat” to watch logs as
usual
Ex : “logwrapper ObbFile_test”
Executing without ‘logwrapper’ Executing with ‘logwrapper’
Log at init process
The first process, 'init‘, does not use Android
Logging System.
‘init’ writes log to (the same node as) '/dev/kmsg'
The same way as 'printk()'
Add a command in init.rc to write Android logs to
kernel logging file, /dev/kmsg
Command :
Watch logs : run “adb shell dmesg” on the host
Shortpoint : duplicated store of Android log
To save output messages of logcat
logcat -f fileName
service logcat /system/bin/logcat -f /dev/kmsg
oneshot
Support Non built-in ADB USB VID (1/2)
ADB built-in USB VID
http://developer.android.com/guide/developing/device.html
#VendorIds
Solution-1 : Append the new USB VID into the
adb_usb.ini file
Commands (executing on the host, e.g.PC/NB) :
Create the folder/file ‘~/.android/adb_usb.ini’ if it does not
exist
‘adb’ command reads and checks content of this file each time it
is executed
echo "New-Vendor-ID" >> ~/.android/adb_usb.ini
sudo -s "adb kill-server;adb start-server“
Example (Lenovo VID : 0x17EF) :
/* It can watch the VID of an Android device
using ‘lsusb’ command under the host */
#> echo "0x17EF" >> ~/.android/adb_usb.ini
#> sudo -s "adb kill-server;adb start-server"
Support Non built-in ADB USB VID (2/2)
Solution-2 : Build a new ‘adb’ tool supporting new
VID
In AndroidSrc/system/core/adb/usb_vendors.c
#define VENDOR-NAME Vendor-ID
Add an entry with new VENDOR-NAME in variable
builtInVendorIds[] and then compile ‘adb’ sources
Built new ‘adb’ exectuable is under the folder :
out/host/linux-x86/bin/
Ex - In AndroidSrc/system/core/adb/usb_vendors.c :
// Lenovo's USB Vendor ID
#define VENDOR_ID_LENOVO 0x17EF
/** built-in vendor list */
int builtInVendorIds[] = {
....... ,
VENDOR_ID_LENOVO
};
Reference
http://elinux.org/Android_Logging_System
Android Logging system slide -
http://blog.kmckk.com/archives/2936958.html
logwrapper -
http://blog.kmckk.com/archives/2918551.html
Print Call Stack -
http://blog.kmckk.com/archives/2902690.html

More Related Content

What's hot

"Learning AOSP" - Android Hardware Abstraction Layer (HAL)
"Learning AOSP" - Android Hardware Abstraction Layer (HAL)"Learning AOSP" - Android Hardware Abstraction Layer (HAL)
"Learning AOSP" - Android Hardware Abstraction Layer (HAL)Nanik Tolaram
 
Using and Customizing the Android Framework / part 4 of Embedded Android Work...
Using and Customizing the Android Framework / part 4 of Embedded Android Work...Using and Customizing the Android Framework / part 4 of Embedded Android Work...
Using and Customizing the Android Framework / part 4 of Embedded Android Work...Opersys inc.
 
Embedded Android Workshop
Embedded Android WorkshopEmbedded Android Workshop
Embedded Android WorkshopOpersys inc.
 
Android Boot Time Optimization
Android Boot Time OptimizationAndroid Boot Time Optimization
Android Boot Time OptimizationKan-Ru Chen
 
Learning AOSP - Android Linux Device Driver
Learning AOSP - Android Linux Device DriverLearning AOSP - Android Linux Device Driver
Learning AOSP - Android Linux Device DriverNanik Tolaram
 
Tuning Android for low RAM
Tuning Android for low RAMTuning Android for low RAM
Tuning Android for low RAMChris Simmonds
 
Android Automotive
Android AutomotiveAndroid Automotive
Android AutomotiveOpersys inc.
 
Q4.11: Porting Android to new Platforms
Q4.11: Porting Android to new PlatformsQ4.11: Porting Android to new Platforms
Q4.11: Porting Android to new PlatformsLinaro
 
Understanding the Android System Server
Understanding the Android System ServerUnderstanding the Android System Server
Understanding the Android System ServerOpersys inc.
 
Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...
Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...
Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...Opersys inc.
 
Booting Android: bootloaders, fastboot and boot images
Booting Android: bootloaders, fastboot and boot imagesBooting Android: bootloaders, fastboot and boot images
Booting Android: bootloaders, fastboot and boot imagesChris Simmonds
 

What's hot (20)

Embedded Android : System Development - Part IV
Embedded Android : System Development - Part IVEmbedded Android : System Development - Part IV
Embedded Android : System Development - Part IV
 
"Learning AOSP" - Android Hardware Abstraction Layer (HAL)
"Learning AOSP" - Android Hardware Abstraction Layer (HAL)"Learning AOSP" - Android Hardware Abstraction Layer (HAL)
"Learning AOSP" - Android Hardware Abstraction Layer (HAL)
 
Using and Customizing the Android Framework / part 4 of Embedded Android Work...
Using and Customizing the Android Framework / part 4 of Embedded Android Work...Using and Customizing the Android Framework / part 4 of Embedded Android Work...
Using and Customizing the Android Framework / part 4 of Embedded Android Work...
 
Init of Android
Init of AndroidInit of Android
Init of Android
 
Embedded Android Workshop
Embedded Android WorkshopEmbedded Android Workshop
Embedded Android Workshop
 
Android Boot Time Optimization
Android Boot Time OptimizationAndroid Boot Time Optimization
Android Boot Time Optimization
 
Logging system of Android
Logging system of AndroidLogging system of Android
Logging system of Android
 
Embedded Android : System Development - Part II (HAL)
Embedded Android : System Development - Part II (HAL)Embedded Android : System Development - Part II (HAL)
Embedded Android : System Development - Part II (HAL)
 
Learning AOSP - Android Linux Device Driver
Learning AOSP - Android Linux Device DriverLearning AOSP - Android Linux Device Driver
Learning AOSP - Android Linux Device Driver
 
Tuning Android for low RAM
Tuning Android for low RAMTuning Android for low RAM
Tuning Android for low RAM
 
Android Automotive
Android AutomotiveAndroid Automotive
Android Automotive
 
Android Binder: Deep Dive
Android Binder: Deep DiveAndroid Binder: Deep Dive
Android Binder: Deep Dive
 
Q4.11: Porting Android to new Platforms
Q4.11: Porting Android to new PlatformsQ4.11: Porting Android to new Platforms
Q4.11: Porting Android to new Platforms
 
Understanding the Android System Server
Understanding the Android System ServerUnderstanding the Android System Server
Understanding the Android System Server
 
Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...
Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...
Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...
 
Android Things : Building Embedded Devices
Android Things : Building Embedded DevicesAndroid Things : Building Embedded Devices
Android Things : Building Embedded Devices
 
Booting Android: bootloaders, fastboot and boot images
Booting Android: bootloaders, fastboot and boot imagesBooting Android: bootloaders, fastboot and boot images
Booting Android: bootloaders, fastboot and boot images
 
Android IPC Mechanism
Android IPC MechanismAndroid IPC Mechanism
Android IPC Mechanism
 
Linux Programming
Linux ProgrammingLinux Programming
Linux Programming
 
Low Level View of Android System Architecture
Low Level View of Android System ArchitectureLow Level View of Android System Architecture
Low Level View of Android System Architecture
 

Viewers also liked

Android crash debugging
Android crash debuggingAndroid crash debugging
Android crash debuggingAshish Agrawal
 
ADB(Android Debug Bridge): How it works?
ADB(Android Debug Bridge): How it works?ADB(Android Debug Bridge): How it works?
ADB(Android Debug Bridge): How it works?Tetsuyuki Kobayashi
 
Effortless network response logging on Android
Effortless network response logging on AndroidEffortless network response logging on Android
Effortless network response logging on AndroidSimon Percic
 
GNOME GeoClue - The Geolocation Service in Gnome
GNOME GeoClue - The Geolocation Service in GnomeGNOME GeoClue - The Geolocation Service in Gnome
GNOME GeoClue - The Geolocation Service in GnomeWilliam Lee
 
Android Debugging (Chinese)
Android Debugging (Chinese)Android Debugging (Chinese)
Android Debugging (Chinese)William Lee
 
Android Services and Managers Basic
Android Services and Managers BasicAndroid Services and Managers Basic
Android Services and Managers BasicWilliam Lee
 
Moblin2 - Window Manager(Mutter) Plugin
Moblin2 - Window Manager(Mutter) PluginMoblin2 - Window Manager(Mutter) Plugin
Moblin2 - Window Manager(Mutter) PluginWilliam Lee
 
Android Storage - StorageManager & OBB
Android Storage - StorageManager & OBBAndroid Storage - StorageManager & OBB
Android Storage - StorageManager & OBBWilliam Lee
 
Usage Note of Qt ODBC Database Access on Linux
Usage Note of Qt ODBC Database Access on LinuxUsage Note of Qt ODBC Database Access on Linux
Usage Note of Qt ODBC Database Access on LinuxWilliam Lee
 
Introdunction To Network Management Protocols SNMP & TR-069
Introdunction To Network Management Protocols SNMP & TR-069Introdunction To Network Management Protocols SNMP & TR-069
Introdunction To Network Management Protocols SNMP & TR-069William Lee
 
CWMP TR-069 Training (Chinese)
CWMP TR-069 Training (Chinese)CWMP TR-069 Training (Chinese)
CWMP TR-069 Training (Chinese)William Lee
 
Qt Development Tools
Qt Development ToolsQt Development Tools
Qt Development ToolsWilliam Lee
 
Asterisk (IP-PBX) CDR Log Rotation
Asterisk (IP-PBX) CDR Log RotationAsterisk (IP-PBX) CDR Log Rotation
Asterisk (IP-PBX) CDR Log RotationWilliam Lee
 
Android Activity Transition(ShareElement)
Android Activity Transition(ShareElement)Android Activity Transition(ShareElement)
Android Activity Transition(ShareElement)Ted Liang
 

Viewers also liked (20)

Android crash debugging
Android crash debuggingAndroid crash debugging
Android crash debugging
 
ADB(Android Debug Bridge): How it works?
ADB(Android Debug Bridge): How it works?ADB(Android Debug Bridge): How it works?
ADB(Android Debug Bridge): How it works?
 
Android - ADB
Android - ADBAndroid - ADB
Android - ADB
 
Effortless network response logging on Android
Effortless network response logging on AndroidEffortless network response logging on Android
Effortless network response logging on Android
 
GNOME GeoClue - The Geolocation Service in Gnome
GNOME GeoClue - The Geolocation Service in GnomeGNOME GeoClue - The Geolocation Service in Gnome
GNOME GeoClue - The Geolocation Service in Gnome
 
Android Debugging (Chinese)
Android Debugging (Chinese)Android Debugging (Chinese)
Android Debugging (Chinese)
 
Android Services and Managers Basic
Android Services and Managers BasicAndroid Services and Managers Basic
Android Services and Managers Basic
 
Moblin2 - Window Manager(Mutter) Plugin
Moblin2 - Window Manager(Mutter) PluginMoblin2 - Window Manager(Mutter) Plugin
Moblin2 - Window Manager(Mutter) Plugin
 
Android Storage - StorageManager & OBB
Android Storage - StorageManager & OBBAndroid Storage - StorageManager & OBB
Android Storage - StorageManager & OBB
 
Usage Note of Qt ODBC Database Access on Linux
Usage Note of Qt ODBC Database Access on LinuxUsage Note of Qt ODBC Database Access on Linux
Usage Note of Qt ODBC Database Access on Linux
 
Introdunction To Network Management Protocols SNMP & TR-069
Introdunction To Network Management Protocols SNMP & TR-069Introdunction To Network Management Protocols SNMP & TR-069
Introdunction To Network Management Protocols SNMP & TR-069
 
CWMP TR-069 Training (Chinese)
CWMP TR-069 Training (Chinese)CWMP TR-069 Training (Chinese)
CWMP TR-069 Training (Chinese)
 
Qt Development Tools
Qt Development ToolsQt Development Tools
Qt Development Tools
 
Android internals
Android internalsAndroid internals
Android internals
 
Asterisk (IP-PBX) CDR Log Rotation
Asterisk (IP-PBX) CDR Log RotationAsterisk (IP-PBX) CDR Log Rotation
Asterisk (IP-PBX) CDR Log Rotation
 
IPv6 Overview
IPv6 OverviewIPv6 Overview
IPv6 Overview
 
Google android Activity lifecycle
Google android Activity lifecycle Google android Activity lifecycle
Google android Activity lifecycle
 
The android activity lifecycle
The android activity lifecycleThe android activity lifecycle
The android activity lifecycle
 
MGCP Overview
MGCP OverviewMGCP Overview
MGCP Overview
 
Android Activity Transition(ShareElement)
Android Activity Transition(ShareElement)Android Activity Transition(ShareElement)
Android Activity Transition(ShareElement)
 

Similar to Android Logging System

.Net Debugging Techniques
.Net Debugging Techniques.Net Debugging Techniques
.Net Debugging TechniquesBala Subra
 
.NET Debugging Tips and Techniques
.NET Debugging Tips and Techniques.NET Debugging Tips and Techniques
.NET Debugging Tips and TechniquesBala Subra
 
Android porting for dummies @droidconin 2011
Android porting for dummies @droidconin 2011Android porting for dummies @droidconin 2011
Android porting for dummies @droidconin 2011pundiramit
 
Android developmenttools 20100424
Android developmenttools 20100424Android developmenttools 20100424
Android developmenttools 20100424Marakana Inc.
 
Android tools for testers
Android tools for testersAndroid tools for testers
Android tools for testersMaksim Kovalev
 
Working with the AOSP - Linaro Connect Asia 2013
Working with the AOSP - Linaro Connect Asia 2013Working with the AOSP - Linaro Connect Asia 2013
Working with the AOSP - Linaro Connect Asia 2013Opersys inc.
 
Life of a Chromium Developer
Life of a Chromium DeveloperLife of a Chromium Developer
Life of a Chromium Developermpaproductions
 
lecture-2-android-dev.pdf
lecture-2-android-dev.pdflecture-2-android-dev.pdf
lecture-2-android-dev.pdfjakjak36
 
Advanced iOS Debbuging (Reloaded)
Advanced iOS Debbuging (Reloaded)Advanced iOS Debbuging (Reloaded)
Advanced iOS Debbuging (Reloaded)Massimo Oliviero
 
Android OS Porting: Introduction
Android OS Porting: IntroductionAndroid OS Porting: Introduction
Android OS Porting: IntroductionJollen Chen
 
Using the android ndk - DroidCon Paris 2014
Using the android ndk - DroidCon Paris 2014Using the android ndk - DroidCon Paris 2014
Using the android ndk - DroidCon Paris 2014Paris Android User Group
 
Eric Lafortune - Fighting application size with ProGuard and beyond
Eric Lafortune - Fighting application size with ProGuard and beyondEric Lafortune - Fighting application size with ProGuard and beyond
Eric Lafortune - Fighting application size with ProGuard and beyondGuardSquare
 
Eric Lafortune - Fighting application size with ProGuard and beyond
Eric Lafortune - Fighting application size with ProGuard and beyondEric Lafortune - Fighting application size with ProGuard and beyond
Eric Lafortune - Fighting application size with ProGuard and beyondGuardSquare
 
Debugging Python with gdb
Debugging Python with gdbDebugging Python with gdb
Debugging Python with gdbRoman Podoliaka
 
An Introduction To Android
An Introduction To AndroidAn Introduction To Android
An Introduction To Androidnatdefreitas
 
C# Production Debugging Made Easy
 C# Production Debugging Made Easy C# Production Debugging Made Easy
C# Production Debugging Made EasyAlon Fliess
 

Similar to Android Logging System (20)

.Net Debugging Techniques
.Net Debugging Techniques.Net Debugging Techniques
.Net Debugging Techniques
 
.NET Debugging Tips and Techniques
.NET Debugging Tips and Techniques.NET Debugging Tips and Techniques
.NET Debugging Tips and Techniques
 
Android porting for dummies @droidconin 2011
Android porting for dummies @droidconin 2011Android porting for dummies @droidconin 2011
Android porting for dummies @droidconin 2011
 
Android developmenttools 20100424
Android developmenttools 20100424Android developmenttools 20100424
Android developmenttools 20100424
 
Android basics
Android basicsAndroid basics
Android basics
 
Android tools for testers
Android tools for testersAndroid tools for testers
Android tools for testers
 
Working with the AOSP - Linaro Connect Asia 2013
Working with the AOSP - Linaro Connect Asia 2013Working with the AOSP - Linaro Connect Asia 2013
Working with the AOSP - Linaro Connect Asia 2013
 
Life of a Chromium Developer
Life of a Chromium DeveloperLife of a Chromium Developer
Life of a Chromium Developer
 
lecture-2-android-dev.pdf
lecture-2-android-dev.pdflecture-2-android-dev.pdf
lecture-2-android-dev.pdf
 
Advanced iOS Debbuging (Reloaded)
Advanced iOS Debbuging (Reloaded)Advanced iOS Debbuging (Reloaded)
Advanced iOS Debbuging (Reloaded)
 
Android OS Porting: Introduction
Android OS Porting: IntroductionAndroid OS Porting: Introduction
Android OS Porting: Introduction
 
Using the android ndk - DroidCon Paris 2014
Using the android ndk - DroidCon Paris 2014Using the android ndk - DroidCon Paris 2014
Using the android ndk - DroidCon Paris 2014
 
Eric Lafortune - Fighting application size with ProGuard and beyond
Eric Lafortune - Fighting application size with ProGuard and beyondEric Lafortune - Fighting application size with ProGuard and beyond
Eric Lafortune - Fighting application size with ProGuard and beyond
 
Eric Lafortune - Fighting application size with ProGuard and beyond
Eric Lafortune - Fighting application size with ProGuard and beyondEric Lafortune - Fighting application size with ProGuard and beyond
Eric Lafortune - Fighting application size with ProGuard and beyond
 
Android dev
Android devAndroid dev
Android dev
 
Debugging Python with gdb
Debugging Python with gdbDebugging Python with gdb
Debugging Python with gdb
 
Android Attacks
Android AttacksAndroid Attacks
Android Attacks
 
An Introduction To Android
An Introduction To AndroidAn Introduction To Android
An Introduction To Android
 
Book
BookBook
Book
 
C# Production Debugging Made Easy
 C# Production Debugging Made Easy C# Production Debugging Made Easy
C# Production Debugging Made Easy
 

More from William Lee

Usage Note of Apache Thrift for C++ Java PHP Languages
Usage Note of Apache Thrift for C++ Java PHP LanguagesUsage Note of Apache Thrift for C++ Java PHP Languages
Usage Note of Apache Thrift for C++ Java PHP LanguagesWilliam Lee
 
Usage Note of SWIG for PHP
Usage Note of SWIG for PHPUsage Note of SWIG for PHP
Usage Note of SWIG for PHPWilliam Lee
 
Upgrade GCC & Install Qt 5.4 on CentOS 6.5
Upgrade GCC & Install Qt 5.4 on CentOS 6.5 Upgrade GCC & Install Qt 5.4 on CentOS 6.5
Upgrade GCC & Install Qt 5.4 on CentOS 6.5 William Lee
 
Usage Notes of The Bro 2.2 / 2.3
Usage Notes of The Bro 2.2 / 2.3Usage Notes of The Bro 2.2 / 2.3
Usage Notes of The Bro 2.2 / 2.3William Lee
 
Viewing Android Source Files in Eclipse (Chinese)
Viewing Android Source Files in Eclipse  (Chinese)Viewing Android Source Files in Eclipse  (Chinese)
Viewing Android Source Files in Eclipse (Chinese)William Lee
 
Usage Note of Microsoft Dependency Walker
Usage Note of Microsoft Dependency WalkerUsage Note of Microsoft Dependency Walker
Usage Note of Microsoft Dependency WalkerWilliam Lee
 
Usage Note of PlayCap
Usage Note of PlayCapUsage Note of PlayCap
Usage Note of PlayCapWilliam Lee
 
Qt4 App - Sliding Window
Qt4 App - Sliding WindowQt4 App - Sliding Window
Qt4 App - Sliding WindowWilliam Lee
 
GTK+ 2.0 App - Desktop App Chooser
GTK+ 2.0 App - Desktop App ChooserGTK+ 2.0 App - Desktop App Chooser
GTK+ 2.0 App - Desktop App ChooserWilliam Lee
 
GTK+ 2.0 App - Icon Chooser
GTK+ 2.0 App - Icon ChooserGTK+ 2.0 App - Icon Chooser
GTK+ 2.0 App - Icon ChooserWilliam Lee
 
Note of CGI and ASP
Note of CGI and ASPNote of CGI and ASP
Note of CGI and ASPWilliam Lee
 
L.A.M.P Installation Note --- CentOS 6.5
L.A.M.P Installation Note --- CentOS 6.5L.A.M.P Installation Note --- CentOS 6.5
L.A.M.P Installation Note --- CentOS 6.5William Lee
 
C Program Runs on Wrong Target Platform(CPU Architecture)
C Program Runs on Wrong Target Platform(CPU Architecture)C Program Runs on Wrong Target Platform(CPU Architecture)
C Program Runs on Wrong Target Platform(CPU Architecture)William Lee
 
Internationalization(i18n) of Web Page
Internationalization(i18n) of Web PageInternationalization(i18n) of Web Page
Internationalization(i18n) of Web PageWilliam Lee
 
Notes for SQLite3 Usage
Notes for SQLite3 UsageNotes for SQLite3 Usage
Notes for SQLite3 UsageWilliam Lee
 
Cygwin Install How-To (Chinese)
Cygwin Install How-To (Chinese)Cygwin Install How-To (Chinese)
Cygwin Install How-To (Chinese)William Lee
 
Study of Chromium OS
Study of Chromium OSStudy of Chromium OS
Study of Chromium OSWilliam Lee
 
More Details about TR-069 (CPE WAN Management Protocol)
More Details about TR-069 (CPE WAN Management Protocol)More Details about TR-069 (CPE WAN Management Protocol)
More Details about TR-069 (CPE WAN Management Protocol)William Lee
 
Introdunction to Network Management Protocols - SNMP & TR-069
Introdunction to Network Management Protocols - SNMP & TR-069Introdunction to Network Management Protocols - SNMP & TR-069
Introdunction to Network Management Protocols - SNMP & TR-069William Lee
 

More from William Lee (20)

Usage Note of Apache Thrift for C++ Java PHP Languages
Usage Note of Apache Thrift for C++ Java PHP LanguagesUsage Note of Apache Thrift for C++ Java PHP Languages
Usage Note of Apache Thrift for C++ Java PHP Languages
 
Usage Note of SWIG for PHP
Usage Note of SWIG for PHPUsage Note of SWIG for PHP
Usage Note of SWIG for PHP
 
Upgrade GCC & Install Qt 5.4 on CentOS 6.5
Upgrade GCC & Install Qt 5.4 on CentOS 6.5 Upgrade GCC & Install Qt 5.4 on CentOS 6.5
Upgrade GCC & Install Qt 5.4 on CentOS 6.5
 
Usage Notes of The Bro 2.2 / 2.3
Usage Notes of The Bro 2.2 / 2.3Usage Notes of The Bro 2.2 / 2.3
Usage Notes of The Bro 2.2 / 2.3
 
Viewing Android Source Files in Eclipse (Chinese)
Viewing Android Source Files in Eclipse  (Chinese)Viewing Android Source Files in Eclipse  (Chinese)
Viewing Android Source Files in Eclipse (Chinese)
 
Usage Note of Microsoft Dependency Walker
Usage Note of Microsoft Dependency WalkerUsage Note of Microsoft Dependency Walker
Usage Note of Microsoft Dependency Walker
 
Usage Note of PlayCap
Usage Note of PlayCapUsage Note of PlayCap
Usage Note of PlayCap
 
Qt4 App - Sliding Window
Qt4 App - Sliding WindowQt4 App - Sliding Window
Qt4 App - Sliding Window
 
GTK+ 2.0 App - Desktop App Chooser
GTK+ 2.0 App - Desktop App ChooserGTK+ 2.0 App - Desktop App Chooser
GTK+ 2.0 App - Desktop App Chooser
 
GTK+ 2.0 App - Icon Chooser
GTK+ 2.0 App - Icon ChooserGTK+ 2.0 App - Icon Chooser
GTK+ 2.0 App - Icon Chooser
 
Note of CGI and ASP
Note of CGI and ASPNote of CGI and ASP
Note of CGI and ASP
 
L.A.M.P Installation Note --- CentOS 6.5
L.A.M.P Installation Note --- CentOS 6.5L.A.M.P Installation Note --- CentOS 6.5
L.A.M.P Installation Note --- CentOS 6.5
 
C Program Runs on Wrong Target Platform(CPU Architecture)
C Program Runs on Wrong Target Platform(CPU Architecture)C Program Runs on Wrong Target Platform(CPU Architecture)
C Program Runs on Wrong Target Platform(CPU Architecture)
 
Internationalization(i18n) of Web Page
Internationalization(i18n) of Web PageInternationalization(i18n) of Web Page
Internationalization(i18n) of Web Page
 
Notes for SQLite3 Usage
Notes for SQLite3 UsageNotes for SQLite3 Usage
Notes for SQLite3 Usage
 
Cygwin Install How-To (Chinese)
Cygwin Install How-To (Chinese)Cygwin Install How-To (Chinese)
Cygwin Install How-To (Chinese)
 
Study of Chromium OS
Study of Chromium OSStudy of Chromium OS
Study of Chromium OS
 
More Details about TR-069 (CPE WAN Management Protocol)
More Details about TR-069 (CPE WAN Management Protocol)More Details about TR-069 (CPE WAN Management Protocol)
More Details about TR-069 (CPE WAN Management Protocol)
 
Introdunction to Network Management Protocols - SNMP & TR-069
Introdunction to Network Management Protocols - SNMP & TR-069Introdunction to Network Management Protocols - SNMP & TR-069
Introdunction to Network Management Protocols - SNMP & TR-069
 
Qt Animation
Qt AnimationQt Animation
Qt Animation
 

Recently uploaded

Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Principled Technologies
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesBoston Institute of Analytics
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 

Recently uploaded (20)

Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 

Android Logging System

  • 2. Outline Overview of Android Loggin System Log from Java program Log from Native C/C++ program How to read log? Tips
  • 4. What is Android Logging System? Provide a mechanism for collecting and viewing system debug output Logs from various applications and portions of the system are collected in a series of circular buffers, which then can be viewed and filtered by the logcat command
  • 5. Overview of Logging System [Android Device] [HOST/PC] USB cable
  • 6. Introduction The logging system consists of A kernel driver and kernel buffers for storing log messages HoneycombMR2Src/kernel/drivers/staging/android/logger.c Create “/dev/log” folder in handle_device_event() of AndroidSrc/system/core/init/devices.c C/C++/Java APIs and classes For making log messages For accessing the log messages logcat, the command for viewing log messages AndroidSrc/system/core/logcat/ Ability to view and filter the log messages from the host machine (via Eclipse-ADT or DDMS)
  • 7. Log device files 4 channels, each have a Ring/Circular Buffer /dev/log/radio – radio&phone-related messages (64KB) /dev/log/events – system/hardware events (256KB) /dev/log/system –framwork or low-level system messages (64KB) /dev/log/main – everything else (64KB) The maximum log message size of each channel is specified in kernel driver(logger.c) File permission of each(radio/events/system/main) is 0662 (rw-rw-w) owner/group RW, other Write only owner=root, group=log Anyone can Write logs, root or log group can Read them
  • 8. Android Debug Bridge ADB client Runs on your development machine(Host). You can invoke a client from a shell by issuing an “adb” command. Other Android tools such as the ADT plugin and DDMS also create adb clients. ADB server (adbserver) Runs on your development machine(Host). The server manages communication between the client and the adb daemon running on an emulator or device. ADB daemon (adbd) Runs on each Android emulator or Android device instance.
  • 9. Log from Java program
  • 10. Classes used for Logging android.util.Log class System.out / System.err
  • 11. android.util.Log Static methods AndroidSrc/frameworks/base/core/java/android/util/Log. java Error messageLog.e (String tag, String msg) Warrning messageLog.w (String tag, String msg) Info messageLog.i (String tag, String msg) Debugging messageLog.d (String tag, String msg) Verbose messageLog.v (String tag, String msg) Example : /* In Java code, add the following codes */ import android.util.Log; class CCLLAASS { static String TAG=“tagName”; public MethodXX() { Log.v(TAG, “Debugging messages you want”); } }
  • 12. System.out / System.err (1/2) System.out/System.err output to Android log zygoteInit() { System.setOut(AndroidPrintStream); System.setErr(AndroidPrintStream); } AndroidSrc/frameworks/base/core/java/com/android/internal/o s/RuntimeInit.java com.android.internal.os.AndroidPrintStream (which derives from LoggingPrintStream which derives from PrintStream) AndroidSrc/frameworks/base/core/java/com/android/internal/o s/AndroidPrintStream.java
  • 13. System.out / System.err (2/2) How to identify instance of System.out/System.err? System.out.println(”System.out=”+System.out.toString()) System.err.println(”System.err=”+System.err.toString()) Example : /* Add the System.out and System.err statements in the constructor of MountService.java */ class MountService { MountService() { …. System.out.println(”System.out’s instance is ”+System.out.toString()); System.err.println(”System.err’s instance is ”+System.err.toString()); …. } }
  • 14. Log from Native C/C++ program
  • 15. Library for Logging Use liblog library Include <android/log.h> header <cutils/log.h>(libcutils) header could be used This header includes <android/log.h> eventually __android_log_print macro(defined in liblog) is the actual worker behind LOGI[V/D/W/E] functions Example : #define LOGI(...) __android_log_print (ANDROID_LOG_INFO,LOG_TAG,__VA_ARGS__) Usage : LOGI(”i=%d, name=%sn”, i, name);
  • 16. Log From Native Program (1/2) Log functions Error messageLOGE (String msg) Warrning messageLOGW (String msg) Info messageLOGI (String msg) Debugging messageLOGD (String msg) Verbose message.LOGV (String msg) Example : /* In C/C++ code, add the following codes*/ #define LOG_TAG “tagName” #include <cutils/log.h> LOGV(“Debugging messages you want”);
  • 17. Log From Native Program (2/2) It must add following definition BEFORE the header "#include <cutils/log.h>" #undef NDEBUG : Enable LOGV/LOGI/LOGD #define LOG_NDEBUG 0 : Enable LOGV #define LOG_NIDEBUG 0 : Enable LOGI #define LOG_NDDEBUG 0 : Enable LOGD #define LOG_TAG “String-You-Want" Because all the above are defined in <cutils/log.h>, if the define is put after the header including statment, it will show “redefined” compile warning and define will not take effect
  • 18. How to read log?
  • 19. Logcat Command “logcat” command runs on Android device Use the command to run ‘logcat’ command on the remote Android device : “adb shell logcat”
  • 20. ADB Logcat Command : adb logcat
  • 21. Logcat pane in ADT, Eclipse
  • 22. Tips Dumping stack trace logwrapper Log at ‘init’ process Support Non built-in ADB USB VID
  • 23. Dumping stack trace (1/2) 3 arguments methods in android.util.Log class Ex: Log.e(String tag, String msg, new Throwable()) Throwable.printStacktrace() also works Dump to System.err
  • 24. Dumping stack trace (2/2) Example for Throwable.printStackTrace (MountService.java) : class MountService extends IMountService.Stub implements INativeDaemonConnectorCallbacks { public static void NewException() throws Throwable { throw new Throwable("New Exception..."); } public MountSerivce(Context context) { … try { NewException(); } catch (Throwable e) { // Prints this throwable and its backtrace to the // standard error stream. e.printStackTrace(); } ... } … }
  • 25. logwrapper Redirects stdout(like printf)/stderr to Android Logging system Usage “logwrapper Executable”, and use “logcat” to watch logs as usual Ex : “logwrapper ObbFile_test” Executing without ‘logwrapper’ Executing with ‘logwrapper’
  • 26. Log at init process The first process, 'init‘, does not use Android Logging System. ‘init’ writes log to (the same node as) '/dev/kmsg' The same way as 'printk()' Add a command in init.rc to write Android logs to kernel logging file, /dev/kmsg Command : Watch logs : run “adb shell dmesg” on the host Shortpoint : duplicated store of Android log To save output messages of logcat logcat -f fileName service logcat /system/bin/logcat -f /dev/kmsg oneshot
  • 27. Support Non built-in ADB USB VID (1/2) ADB built-in USB VID http://developer.android.com/guide/developing/device.html #VendorIds Solution-1 : Append the new USB VID into the adb_usb.ini file Commands (executing on the host, e.g.PC/NB) : Create the folder/file ‘~/.android/adb_usb.ini’ if it does not exist ‘adb’ command reads and checks content of this file each time it is executed echo "New-Vendor-ID" >> ~/.android/adb_usb.ini sudo -s "adb kill-server;adb start-server“ Example (Lenovo VID : 0x17EF) : /* It can watch the VID of an Android device using ‘lsusb’ command under the host */ #> echo "0x17EF" >> ~/.android/adb_usb.ini #> sudo -s "adb kill-server;adb start-server"
  • 28. Support Non built-in ADB USB VID (2/2) Solution-2 : Build a new ‘adb’ tool supporting new VID In AndroidSrc/system/core/adb/usb_vendors.c #define VENDOR-NAME Vendor-ID Add an entry with new VENDOR-NAME in variable builtInVendorIds[] and then compile ‘adb’ sources Built new ‘adb’ exectuable is under the folder : out/host/linux-x86/bin/ Ex - In AndroidSrc/system/core/adb/usb_vendors.c : // Lenovo's USB Vendor ID #define VENDOR_ID_LENOVO 0x17EF /** built-in vendor list */ int builtInVendorIds[] = { ....... , VENDOR_ID_LENOVO };
  • 29. Reference http://elinux.org/Android_Logging_System Android Logging system slide - http://blog.kmckk.com/archives/2936958.html logwrapper - http://blog.kmckk.com/archives/2918551.html Print Call Stack - http://blog.kmckk.com/archives/2902690.html