- XDA Basics: How to take logs on Android
- Kernel panic logs
- Driver messages
- System logs
- Android apps for collecting logs
- Logcat Extreme
- Getting Android Logs
- by Alyona Lukina • March 4, 2015
- Android Logging System
- Contents
- Overview
- Kernel driver
- System and Application logging
- Application log
- Event log
- System log
- ‘log’ command line tool
- Capturing stdout with logwrapper
- Logcat command
- Trick to couple Android logging to Linux kernel logging
- Android Kernel Log
- Android: How to get kernel logs after kernel panic .
- Android Logging System — eLinux.org
- Video result for Android Kernel Log
- How to take logs on Android: Logcat, dmesg, and ramoops
- How to get kernel logs on unrooted device? — Android Help .
- [Reference] How to get useful logs | XDA Forums
- How to take logs in Android — xda-developers
- Boot — Does android keep a log of when it starts .
- How to make sense of Android crash logs | Bugsnag Blog
- Building Kernels | Android Open Source Project
- Android Kernel Debugging (kmsg log) | Linux.org
- Logging — How can I view and examine the Android log .
- Android Debugging — eLinux.org
- Log | Android Developers
- Android Log Analysis — pCloudy
- Logging | Android NDK | Android Developers
- Android Kernel ABI Monitoring | Android Open Source Project
- Log — HEAD — kernel/samsung — Git at Google
- KVM for Android [LWN.net]
- Android kernel错误log,帮忙分析。-CSDN论坛
- Introduction to the Linux kernel log levels — LinuxConfig.org
XDA Basics: How to take logs on Android
Logs are very useful when a developer is diagnosing an error with a piece of software. So, as a user, when you complain to a developer about a problem with their Android app or an aftermarket firmware (custom ROM), they’ll ask you to submit a log to help them troubleshoot the issue. Android includes a number of logs that deal with different parts of the firmware, and there are a number of ways to collect those logs. In this guide, we’ll talk about the various common logs and how you can collect them on Android for bug reports.
Before we start, you should set up Android Debug Bridge on your computer as you might need ADB access for some of these logs. We have a great guide on how to set up ADB on any computer.
Kernel panic logs
Kernel panic logs are useful to figure out what happened during an unsuccessful boot. If you’re trying to run a custom ROM but your phone is stuck at the boot loop, you can collect kernel panic logs to help the ROM developer find out what went wrong.
A majority of Android manufacturers use upstream вЂpstore’ and вЂramoops’ drivers to store kernel logs after a panic. Ramoops writes its logs to the RAM before the system crashes. With root access, these logs can be retrieved from:
The file name could be slightly different but it’ll be in the pstore directory. You can get it using ADB pull or any other way you want. For example:
adb pull /sys/fs/pstore/console-ramoops C:\Users\Gaurav\Desktop\filename
Driver messages
The log from the driver messages buffer can be used to diagnose issues with system drivers and why something isn’t working. On Android, you can use the ‘dmesg’ output to get these logs. You’ll need root access to get these logs though. Use the following ADB command to export the complete log.
System logs
System logs are useful when something in the system throws an error. Android allows collecting system logs using Logcat. Log messages can be viewed in a Logcat window in Android Studio, or you can use the command line tool to pull them.
Several Android apps are also available in the Google Play store that allow easy access to these tools. We’ll talk about these apps later in this article. Moreover, several custom ROMs come with options in the Developers settings to collect the system logs.
To collect logs using ADB, use the following command. This command will export a continuous log, so use Ctrl + C to stop it.
You can use the -d parameter to export the complete log in one go.
If you want, you can also view or save the radio buffer using the following command.
If your device is rooted, you can use the Terminal app on the device itself to collect logs. To save a log using Terminal on your phone, type the following command so the log will be saved on your phone.
Android apps for collecting logs
Logcat Extreme
Logcat Extreme can help you read the logcat and dmesg outputs as well as record logs. It requires root access to show logs properly.
Источник
Getting Android Logs
by Alyona Lukina • March 4, 2015
Log-File locations
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). Some examples are:
- /data/anr “Application Not Responding” files
- /data/dontpanic seems to be a standard location (AOSP), and contains some crash logs including traces
- /data/kernelpanics
- /data/panic/panic_daemon.config may point to other locations configured
- /data/panicreports
- /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.
There may be some more locations, but as most logging is done on tmpfs (tmpfs is a common name for a temporary file storage facility on many Unix-like operating systems)
Log commands to use with a terminal app (or adb)
We are able re-direct them to a file ( > filename.ext ) or pipe them through a filter ( | grep search-for-this ):
1. Kernel log
dmesg
Run dmesg from adb to get a live output of the Android kernel logs (just like a logcat shows live output of the system logs).
The kernel logs are important for troubleshooting hardware issues and other low level issues.
It doesn’t require filtering like a logcat, since it is a smaller log. Works without root.
last kmsg
When the Android kernel crashes, it writes logs to last_kmsg.
This is like the last words of your Android device before it passes out. Android writes a quick log to last_kmsg before it reboots. last_kmsg helps to understand the reason of the issue.
There are a few other situations where Android writes to this log, such as kernel panics.
Right after force reboot, connect to ADB, and run:
The last_kmsg log it only written to when a failure causes a crash, random reboot, or kernel panic (or a couple other things). It doesn’t always exist.
2. Logcat
Can e.g. specify what area you are interested in — radio, events, etc.
3. Getting device info
And tons of it: Device specifics, account information, services…
4. All-in-One = 1+2+3 = Bugreport
Make a big ball with everything together, from logcat to dumpstate:
Источник
Android Logging System
This article describes the Android logging system
Contents
Overview
The Android system has a logging facility that allows system-wide logging of information, from applications and system components. This is separate from the Linux kernel’s own logging system, which is accessed using ‘dmesg’ or ‘/proc/kmsg’. However, the logging system does store messages in kernel buffers.
The logging system consists of:
- a kernel driver and kernel buffers for storing log messages
- C, C++ and Java classes for making log entries and for accessing the log messages
- a standalone program for viewing log messages (logcat)
- ability to view and filter the log messages from the host machine (via eclipse or ddms)
There are four different log buffers in the Linux kernel, which provide logging for different parts of the system. Access to the different buffers is via device nodes in the file system, in /dev/log.
The four log buffers are:
- main — the main application log
- events — for system event information
- radio — for radio and phone-related information
- system — a log for low-level system messages and debugging
Up until 2010, only the first three logs existed. The system log was created to keep system messages in a separate buffer (outside of ‘/dev/log/main’) so that a single verbose application couldn’t overrun system messages and cause them to be lost.
Each message in the log consists of a tag indicating the part of the system or application that the message came from, a timestamp, the message log level (or priority of the event represented by the message) and the log message itself.
All of the log buffers except for ‘event’ use free-form text messages. The ‘event’ buffer is a ‘binary’ buffer, where the event messages (and event parameters) are stored in binary form. This form is more compact, but requires extra processing when the event is read from the buffer, as well as a message lookup database, to decode the event strings.
The logging system automatically routes messages with specific tags into the radio buffer. Other messages are placed into their respective buffers when the the log class or library for that buffer is used.
Kernel driver
The kernel driver for logging is called the ‘logger’. See Android logger
System and Application logging
Application log
An Android application includes the android.util.Log class, and uses methods of this class to write messages of different priority into the log.
Java classes declare their tag statically as a string, which they pass to the log method. The log method used indicates the message «severity» (or log level). Messages can be filtered by tag or priority when the logs are processed by retrieval tools (logcat).
Event log
Event logs messages are created using android.util.EventLog class, which create binary-formatted log messages. Log entries consist of binary tag codes, followed by binary parameters. The message tag codes are stored on the system at: /system/etc/event-log-tags. Each message has the string for the log message, as well as codes indicating the values associated with (stored with) that entry.
System log
Many classes in the Android framework utilize the system log to keep their messages separate from (possibly noisy) application log messages. These programs use the android.util.Slog class, with its associated messages.
In all cases, eventually a formatted message is delivered through the C/C++ library down to the kernel driver, which stores the message in the appropriate buffer.
‘log’ command line tool
There is a ‘log’ command line tool that can be used to create log entries from any program. This is built into the ‘toolbox’ multi-function program.
The usage for this is:
Capturing stdout with logwrapper
It is sometimes useful to capture stdout from native applications into the log. There is a utility called ‘logwrapper’ which can be used to run a program, and redirect it’s stdout into log messages.
The logwrapper usage is:
Source for logwrapper is at: system/core/logwrapper/logwrapper.c
Logcat command
You can use the ‘logcat’ command to read the log. This command is located in /system/bin in the local filesystem, or you can access the functionality using the ‘adb logcat’ command.
Some quick notes:
- Log messages each have a tag and priority.
- You can filter the messages by tag and log level, with a different level per tag.
- You can specify (using a system property) that various programs emit their stdout or stderr to the log.
Trick to couple Android logging to Linux kernel logging
Note that the android logging system is completely separate from the Linux kernel log system (which uses printk inside the kernel to save messages and dmesg to extract them). You can write to the kernel log from user space by writing to /dev/kmsg.
I’ve seen a reference to couple the two together, to redirect android messages into the kernel log buffer, using the ‘logcat’ program launched from init, like below:
I’m not sure why you’d want to do this (maybe to put all messages into a single stream? With the same timestamp, if kernel message timestamping is on?)
Источник
Android Kernel Log
Android: How to get kernel logs after kernel panic .
config_android_ram_console=y config_android_ram_console_enable_verbose=y config_apanic=y config_apanic_plabel=»oem_log» My problem is: After I forced a kernel panic in order to test this, i.e. by loading a simple panic kernel module with insmod panic.ko , it seems that no log was written to the MTD named oem_log (which exists on my device).
Android Logging System — eLinux.org
The Android system has a logging facility that allows system-wide logging of information, from applications and system components. This is separate from the Linux kernel’s own logging system, which is accessed using ‘dmesg’ or ‘/proc/kmsg’. However, the logging system does store messages in kernel buffers.
Video result for Android Kernel Log
How to Tweak Your Kernel — XDA App Review
Android Kernel: Change BOOT Image
#HITB2018AMS D1T2 — Rooting Android 8 with a Kernel.
How to take logs on Android: Logcat, dmesg, and ramoops
A majority of Android manufacturers use upstream ‘pstore’ and ‘ramoops’ drivers to store kernel logs after a panic. Ramoops writes its logs to the RAM before the system crashes. With root .
How to get kernel logs on unrooted device? — Android Help .
I’ve been having random reboots — perhaps once per day. I want to see the kernel logs — via dmesg, looking at /proc/last_kmsg, or some such. However, every attempt to do this hits a brick wall because apparently, the OS now blocks me from accessing my own kernel logs. Possible? Unrooted Galaxy S3, Android 4.4.2
[Reference] How to get useful logs | XDA Forums
The three most important log types are: logcat: the logoutput of the Android system; radio logcat: the log outpur ot your System / BB / RIL communication; kernel log (kmsg / dmesg): the kernel messages Additionally there’s the last_kmsg which is a dump of the kernel log until the last shutdown.
How to take logs in Android — xda-developers
Ramoops is a kernel oops/panic logger which gets generated before system crashes. It writes its logs to RAM of the device. In case your device gets stuck at boot loop or keeps getting rebooted on.
Boot — Does android keep a log of when it starts .
When Android boots up, it keeps a cache of the logcat, in a temporary buffer that is reserved found in /dev/log. That buffer gets recycled when it hits the threshold, obviously, the bigger the threshold, the slower Android gets with the continual spamming into the logcat buffer hence kept to minimum — iirc, its around 64K:
How to make sense of Android crash logs | Bugsnag Blog
Android Crash Log Errors: Explained. Crashes on Android can be immensely frustrating for users, so much so that after experiencing as little as two crashes, the typical user will uninstall your app. Fortunately, the Android Framework provides some great tools for debugging crashes, and provides several useful crash logs that developers can read to determine what caused that critical issue.
Building Kernels | Android Open Source Project
The Android tree contains only prebuilt kernel binaries. The kernel trees contain the kernel sources and all tools to build the kernels, including this script. To build older kernels or kernels not listed on this page, refer to the instructions on how to build legacy kernels. Downloading sources and build tools
Android Kernel Debugging (kmsg log) | Linux.org
Holding the «Home,» «Power,» and «Volume Up» hard-keys brings up a menu that allows me to look at system recovery logs. Therein I can access the «kmsg» (kernel message log), and get a printout of it’s processes. There is a list of Kernel commands (I assume that are being administered via remote shell via tty) and a few lines that read, «NOTICE .
Logging — 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. Android 4.0 and older
Android Debugging — eLinux.org
The Linux kernel has a message log in an internal ring buffer. You can access the contents of this log using the ‘dmesg’ command. You can add timing information to the printk messages, by adding «time» to the Linux kernel command line.
Log | Android Developers
Log | Android Developers. Language English Bahasa Indonesia Español — América Latina Português — Brasil 中文 — 简体 日本語 한국어. Documentation. Overview Guides Reference Samples Design & Quality. Platform. Android Studio. Google Play. Jetpack.
Android Log Analysis — pCloudy
The logging system consists of a kernel driver and kernel buffers for storing Android log messages, C, C++ and Java classes for making log entries and for accessing the log messages, a standalone program for viewing log messages (logcat) and the ability to view and filter the log messages from the host machine (via eclipse or ddms).
Logging | Android NDK | Android Developers
Writes an assertion failure to the log (as ANDROID_LOG_FATAL) and to stderr, before calling abort(3).. If fmt is non-null, cond is unused. If fmt is null, the string Assertion failed: s is used with cond as the string argument. If both fmt and cond are null, a default string is provided.. Most callers should use assert(3) from instead, or the __assert and __assert2 functions provided by bionic .
Android Kernel ABI Monitoring | Android Open Source Project
You can use application Binary Interface (ABI) Monitoring tooling, available in Android 11 and higher, to stabilize the in-kernel ABI of Android kernels. The tooling collects and compares ABI representations from existing kernel binaries (vmlinux + modules). These ABI representations are the.xml files and the symbol lists.
Log — HEAD — kernel/samsung — Git at Google
Sign in. android / kernel / samsung / HEAD. eef8e7b empty commit by Jean-Baptiste Queru · 10 years ago master
KVM for Android [LWN.net]
A Google project aims to bring the Linux kernel virtualization mechanism, KVM, to Android systems. Will Deacon leads that effort and he (virtually) came to KVM Forum to discuss the project, its goals, and some of the challenges it has faced. Unlike some Android projects of the past, though, «protected KVM» is being worked on in the open, with code going upstream along the way.
Android kernel错误log,帮忙分析。-CSDN论坛
基于Android N的Log机制浅析 下篇 在上篇中从上层使用 Log 的java接口讲到了liblog中,最终通过socket将要打印的 Log 交给了logd模块处理,本篇就继续来看一下logd模块内部对 Log 的处理过程。
Introduction to the Linux kernel log levels — LinuxConfig.org
The Linux kernel log levels There are basically eight log levels which a message sent by the linux kernel can adopt, starting from level 0 and decreasing in severity ’till level 7: the lowest log level identifier, the most critical context.
Источник