AOSP ~ Logcat 持久化

I found an option to store logs: Settings -> System -> Advanced -> Developer options -> Store logger data persistently on device

Store logger data persistently on device: Select the type of log messages you want to store persistently on the device. Options are off, all, all but radio, or kernel only.

logd is the logging daemon on Android which mainly covers the functionality of its desktop counterpart syslogd, but also includes klogd and partially auditd to get logs from SELinux subsystem of kernel. However logd just reads from different memory buffers (in RAM) and doesn’t save to persistent memory (files) by default. We can use commandline tools logcat and log to read/write from/to logd respectively. Read here more about memory buffers - main, system, radio, events, and crash.

If one needs persistent logs as files, a separate sub-service (available on userdebug and eng builds only since Oreo (1)) named logcatd (logcat daemon which itself reads from logd) can save them to filesystem in /data/misc/logd/ (not accessible without root). Behavior of the service on boot is controlled by properties logd.logpersistd.enable and persist.logd.logpersistd (2). Or to manually start/stop the service shell scripts /system/bin/logpersist.[start|stop] can be used.

The option “Store logger data persistently on device” in “Developer Options” also controls the same service using property persist.logd.logpersistd.buffer. From official documentation:

Store logger data persistently on device: Select the type of log messages you want to store persistently on the device. Options are off, all, all but radio, or kernel only.

参考: https://elinux.org/Android_Logging_System

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值