There is a lot of interesting stuff in the Android system log, that is helpful in many ways
- find root causes of problems
- identify misbehaving apps
How can I view and examine the Android log?
The preferred way is to download the SDK and use adb logcat
(requires to activate "developer options" on device).
There are apps available for viewing the full system log, however they only work on rooted devices or require issuing a manual command via adb
to make them work. For more information view see this question.
You can either download the SDK and use adb logcat
or get Logcat Extrem from the Google Play Store, which shows the log directly on your phone.
There are several directories where logs (including those from crashes) might appear -- not all of them are standardized (i.e. some may be ROM-specific).
/data/anr
: Some trace files seem to get here (Dalvik writes stack traces here on ANR, i.e. "Application Not Responding" aka "Force-Close"; see e.g. log excerpts here)/data/dontpanic
seems to be a standard location (AOSP), and contains some crash logs including traces (see e.g. viaForensics and StackOverflow)/data/kernelpanics
is another location -- not having had any "kernel panic" on my Android devices, I saw no content there yet./data/panic/panic_daemon.config
may point to other locations configured -- on my Droid 2 it mentions /sdcard/panic_data/
/data/panicreports
directory (empty here)/data/tombstones
may hold several tombstone_nn
files (with nn
being a serial, increased with every new file). As tombstones are placed for the dead, it is done here for "processes died by accident" (i.e. crashed) -- and it is what is referred to as "core dumps" on Linux/Unix systems. However, not all apps create tombstones; this must be explicitly enabled by the developer (see Debugging Android Core Dumps).There may be some more locations which escaped me; but as most logging is done on tmpfs
, these data are lost with a reboot, and would not match the OPs question.
Several commands can get you tons of information. For most of them, it is to recommend to re-direct them to a file (> filename.ext
) or pipe them through a filter (| grep search-for-this
):
The following works without root:
$ dmesg
<6>[82839.126586] PM: Syncing filesystems ... done.
<7>[82839.189056] PM: Preparing system for mem sleep
<4>[82839.189361] Freezing user space processes ... (elapsed 0.05 seconds) done.
<4>[82839.240661] Freezing remaining freezable tasks ... (elapsed 0.00 seconds) done.
<snip>
Here you can e.g. specify what area you are interested in -- radio, events...
# logcat -b events
I/am_create_service( 3457): [1085416560,nitro.phonestats/.widget.WidgetProvider4x1$WidgetUpdateService4x1,,3721]
I/am_destroy_service( 3457): [1085416560,nitro.phonestats/.widget.WidgetProvider4x1$WidgetUpdateService4x1,3721]
I/notification_cancel( 3457): [nitro.phonestats,4,0]
<snip>
And tons of it: Device specifics, account information, services...
$ dumpsys
Currently running services:
LocationProxyService
SurfaceFlinger
accessibility
account
activity
<snip>
DUMP OF SERVICE account:
Accounts:
1 Account {[email protected], type=com.google}
<snip>
$ dumpstate
========================================================
== dumpstate: 2012-08-18 23:39:53
========================================================
Build: Gingerbread GWK74 - CyanogenMilestone2
Bootloader: 0x0000
Radio: unknown
<snip>
------ MEMORY INFO (/proc/meminfo) ------
MemTotal: 487344 kB
MemFree: 10436 kB
<snip>
Make a big ball with everything together, from logcat to dumpstate:
$ bugreport > /mnt/sdcard/bugreport.txt
I'm pretty sure you really want to redirect that last command... xD
P.S.: Naturally, access to those information may require root, as most of the sources are located on internal storage.
$ adb shell
to connect to the device via a terminal. (Of course, ensure your device is connected to your computer and that USB debugging has been turned on.)
Commented
Jan 7, 2021 at 1:07
A method without root, that works even with new Android versions:
Prerequisites:
Instructions:
Terminal
into Spotlight and open itadb devices
to verify your device is properly connected.adb logcat
to show the mighty and magic logcat aka stacktrace.(Mostly copied from Leandros)
It is located in /sdcard/bugreports
.