[XDA-University] Stryke_the_Orc:
Reading and understanding logcat output

Reading a Logcat​

Ok, so now we have our log but what do we do with it?

There are a few things that you need to know before you'll understand what is what.

Preceding every line in a logcat is a class, you can learn about them here.

These will look like this and I have placed the meaning next to each:

E/ Error - I would hope this is self explanatory
F/ Fatal Error - Again pretty self explanatory
I/ Information - This is pretty tricky, the information class shows what the system is doing, but it can also show you errors so read it carefully!
D/ Dalvikvm - This class will show what the dalvik processes are doing, but can also show you where mistakes are
W/ Warning - Warnings are basically errors, but less severe. Usually it will show you missing resources, conflicting or missing paths, etc...
V/ Verbose - Basically everything the phone is doing
S/ Silent - You will not see silent

Ok so lets see some examples. Some of these will be more in-depth than others simply because there is more to it.

[COLOR="Red"]D/dalvikvm( 1853): DexOpt: --- BEGIN 'core.jar' (bootstrap=1) ---[/COLOR]
Here we see that the dalvik process has begun to optimize our system files.

[COLOR="red"]D/dalvikvm( 2162): DexOpt: 'Lcom/sec/android/seccamera/SecCamera$OnMultiFrameShotEventListener;' has an earlier definition; blocking out[/COLOR]
Here you can see that the Dalvik process has already defined the called method, and is skipping the optimization

[COLOR="red"]I/PackageManager( 2130): /system/app/sCloudSyncBrowser.apk changed; collecting certs[/COLOR]
The information class is showing that there has been a change made to this apk, and is verifying the signature.

[COLOR="red"]W/ResourceType( 2130): Failure getting entry for 0x7f050020 (t=4 e=32) in package 0 (error -75)

D/PhoneStatusBar( 2792): Added status bar view

D/PhoneStatusBar( 2792): disable: < expand icons alerts ticker system_info back home recent clock >

W/PackageManager( 2130): Failure retrieving xml 0x7f050020 in package com.maxmpz.audioplayer

W/PackageManager( 2130): android.content.res.Resources$NotFoundException: Resource ID #0x7f050020

W/PackageManager( 2130): at android.content.res.Resources.getValue(Resources.java:1339)

W/PackageManager( 2130): at android.content.res.Resources.loadXmlResourceParser(Resources.java:2445)

W/PackageManager( 2130): at android.content.res.Resources.getXml(Resources.java:1227)

W/PackageManager( 2130): at android.app.ApplicationPackageManager.getXml(ApplicationPackageManager.java:1080)

W/PackageManager( 2130): at android.content.pm.PackageItemInfo.loadXmlMetaData(PackageItemInfo.java:227)

W/PackageManager( 2130): at com.android.server.AppWidgetServiceImpl.parseProviderInfoXml(AppWidgetServiceImpl.java:1264)

W/PackageManager( 2130): at com.android.server.AppWidgetServiceImpl.addProviderLocked(AppWidgetServiceImpl.java:1162)

W/PackageManager( 2130): at com.android.server.AppWidgetServiceImpl.loadAppWidgetList(AppWidgetServiceImpl.java:1148)

W/PackageManager( 2130): at com.android.server.AppWidgetServiceImpl.ensureStateLoadedLocked(AppWidgetServiceImpl.java:391)

W/PackageManager( 2130): at com.android.server.AppWidgetServiceImpl.systemReady(AppWidgetServiceImpl.java:211)

W/PackageManager( 2130): at com.android.server.AppWidgetService.systemReady(AppWidgetService.java:156)

W/PackageManager( 2130): at com.android.server.ServerThread$1.run(SystemServer.java:1882)

W/PackageManager( 2130): at com.android.server.am.ActivityManagerService.systemReady(ActivityManagerService.java:8250)

W/PackageManager( 2130): at com.android.server.am.ActivityManagerService$9$1.run(ActivityManagerService.java:8152)

W/PackageManager( 2130): at android.os.Handler.handleCallback(Handler.java:615)

W/PackageManager( 2130): at android.os.Handler.dispatchMessage(Handler.java:92)

W/PackageManager( 2130): at android.os.Looper.loop(Looper.java:137)

W/PackageManager( 2130): at com.android.server.am.ActivityManagerService$AThread.run(ActivityManagerService.java:1563)

W/ResourceType( 2130): Failure getting entry for 0x7f050021 (t=4 e=33) in package 0 (error -75)

W/PackageManager( 2130): Failure retrieving xml 0x7f050021 in package com.maxmpz.audioplayer

W/PackageManager( 2130): android.content.res.Resources$NotFoundException: Resource ID #0x7f050021

W/PackageManager( 2130): at android.content.res.Resources.getValue(Resources.java:1339)

W/PackageManager( 2130): at android.content.res.Resources.loadXmlResourceParser(Resources.java:2445)

W/PackageManager( 2130): at android.content.res.Resources.getXml(Resources.java:1227)

W/PackageManager( 2130): at android.app.ApplicationPackageManager.getXml(ApplicationPackageManager.java:1080)

W/PackageManager( 2130): at android.content.pm.PackageItemInfo.loadXmlMetaData(PackageItemInfo.java:227)

W/PackageManager( 2130): at com.android.server.AppWidgetServiceImpl.parseProviderInfoXml(AppWidgetServiceImpl.java:1264)

W/PackageManager( 2130): at com.android.server.AppWidgetServiceImpl.addProviderLocked(AppWidgetServiceImpl.java:1162)

W/PackageManager( 2130): at com.android.server.AppWidgetServiceImpl.loadAppWidgetList(AppWidgetServiceImpl.java:1148)

W/PackageManager( 2130): at com.android.server.AppWidgetServiceImpl.ensureStateLoadedLocked(AppWidgetServiceImpl.java:391)

W/PackageManager( 2130): at com.android.server.AppWidgetServiceImpl.systemReady(AppWidgetServiceImpl.java:211)

W/PackageManager( 2130): at com.android.server.AppWidgetService.systemReady(AppWidgetService.java:156)

W/PackageManager( 2130): at com.android.server.ServerThread$1.run(SystemServer.java:1882)

W/PackageManager( 2130): at com.android.server.am.ActivityManagerService.systemReady(ActivityManagerService.java:8250)

W/PackageManager( 2130): at com.android.server.am.ActivityManagerService$9$1.run(ActivityManagerService.java:8152)

W/PackageManager( 2130): at android.os.Handler.handleCallback(Handler.java:615)

W/PackageManager( 2130): at android.os.Handler.dispatchMessage(Handler.java:92)

W/PackageManager( 2130): at android.os.Looper.loop(Looper.java:137)

W/PackageManager( 2130): at com.android.server.am.ActivityManagerService$AThread.run(ActivityManagerService.java:1563)[/COLOR]
Here is a great example of the warning class showing missing resources.

[COLOR="red"]I/dalvikvm( 1853): Could not find method android.app.IActivityManager.resizeArrangedWindow, referenced from method android.app.ActivityManager.resizeArrangedWindow

W/dalvikvm( 1853): VFY: unable to resolve interface method 3769: Landroid/app/IActivityManager;.resizeArrangedWindow (IILandroid/graphics/Rect;)Landroid/graphics/Rect;

D/dalvikvm( 1853): VFY: replacing opcode 0x72 at 0x0004[/COLOR]
A prime example of Information class showing an "error", these will usually be listed in information class if they don't have a great impact of the functionality of the device.

[COLOR="red"]F/PackageManager( 2014): Unable to backup package manager settings, current changes will be lost at reboot
E/DropBoxManagerService(2014): Can't write: system_server_wtf
E/DropBoxManagerService(2014): java.io.FileNotFoundException: /data/system/dropbox/drop21.tmp: open failed: EROFS (Read-only file system)
E/DropBoxManagerService(2014): at libcore.io.IoBridge.open(IoBridge.java:416)
E/DropBoxManagerService(2014): at java.io.FileOutputStream.(FileOutputStream.java:88)
E/DropBoxManagerService(2014): at java.io.FileOutputStream.(FileOutputStream.java:73)
E/DropBoxManagerService(2014): at com.android.server.DropBoxManagerService.add(DropBoxManagerService.java:208)
E/DropBoxManagerService(2014): at android.os.DropBoxManager.addText(DropBoxManager.java:272)
E/DropBoxManagerService(2014): at com.android.server.am.ActivityManagerService$13.run(ActivityManagerService.java:8281)
E/DropBoxManagerService(2014): at com.android.server.am.ActivityManagerService.addErrorToDropBox(ActivityManagerService.java:8288)
E/DropBoxManagerService(2014): at com.android.server.am.ActivityManagerService.handleApplicationWtf(ActivityManagerService.java:8099)
E/DropBoxManagerService(2014): at com.android.internal.os.RuntimeInit.wtf(RuntimeInit.java:329)
E/DropBoxManagerService(2014): at android.util.Log$1.onTerribleFailure(Log.java:103)
E/DropBoxManagerService(2014): at android.util.Log.wtf(Log.java:278)
E/DropBoxManagerService(2014): at android.util.Log.wtf(Log.java:255)
E/DropBoxManagerService(2014): at com.android.server.pm.Settings.writeLPr(Settings.java:1115)
E/DropBoxManagerService(2014): at com.android.server.pm.PackageManagerService.unloadMediaPackages(PackageManagerService.java:9314)
E/DropBoxManagerService(2014): at com.android.server.pm.PackageManagerService.updateExternalMediaStatusInner(PackageManagerService.java:9128)
E/DropBoxManagerService(2014): at com.android.server.pm.PackageManagerService.access$3800(PackageManagerService.java:165)
E/DropBoxManagerService(2014): at com.android.server.pm.PackageManagerService$10.run(PackageManagerService.java:9017)
E/DropBoxManagerService(2014): at android.os.Handler.handleCallback(Handler.java:615)
E/DropBoxManagerService(2014): at android.os.Handler.dispatchMessage(Handler.java:92)
E/DropBoxManagerService(2014): at android.os.Looper.loop(Looper.java:137)
E/DropBoxManagerService(2014): at android.os.HandlerThread.run(HandlerThread.java:60)
E/DropBoxManagerService(2014): Caused by: libcore.io.ErrnoException: open failed: EROFS (Read-only file system)
E/DropBoxManagerService(2014): at libcore.io.Posix.open(Native Method)
E/DropBoxManagerService(2014): at libcore.io.BlockGuardOs.open(BlockGuardOs.java:110)
E/DropBoxManagerService(2014): at libcore.io.IoBridge.open(IoBridge.java:400)
E/DropBoxManagerService(2014): ... 20 more[/COLOR]
Here we have the Fatal and Error classes.

Ok, so now we have seen some examples, lets learn to decipher them:highfive:

The beautiful thing about these logs is that they tell you exactly what and where everything is, as long as you know what you're looking at.

I'm only going to use the one line to show you how to read a log, as the format is exactly the same for any class.

E/DropBoxManagerService(2014): at com.android.server.am.ActivityManagerService.addErrorToDropBox(ActivityManagerService.java:8288)

So here we have the printed error from logcat, the format used is as follows
Class/Process/Location
[b]Important! The log WILL NOT tell you what apk or jar the error occurs in, this is the hardest part of debugging![/b]

In the above error we see
Class = E/
Process = DropBoxManagerService
Location = com.android.server.am.ActivityManagerService.addErrorToDropBox(ActivityManagerService.java:8288) (Folder directory.File Name. Method)

I know from all my digging that the specified path is in services.jar so once I have services.jar decompiled I'll follow the path laid out. (Decompile "apkname".odex for odexed roms and classes.dex for deodexed roms)
These paths will always be located in the smali folder! For example I open my classes.dex folder after decompiling and see a smali folder, I'll open that and then I have options. The . after every word is a folder directory ( same as / in your computer directory )
The specified path says com. so I'll open the com folder, next I'm directed to android, then server, then am folder.
Now I should see a bunch of files and possibly some folders, [b]if there is no folder name that matches the next directory it is a file![/b]
ActivityManagerService is a filename, so I'll open that file using NotePad++ and search for the specified method which is addErrorToDropBox.
From here I can use another file to compare the lines to find my error, or I can know exactly where the error occured and report my problem to a helpful dev or member.

I hope that this has been a good learning experience and will help you to understand any issues you are facing.

:victory: