There are two items in the android developer options related to system logs.
1. Logger buffer size
2. Store logger data permanently on the device
One is used to set the buffer size, and the other is used to switch and filter log storage.
By analyzing system/core/logcat/logcatd.rc
mkdir /data/misc/logd 0770 logd log
The storage path of the log is /data/misc/logd
For the logs stored in this path, after each restart of the machine, the last log will be saved as logcat.id, such as logcat.001, logcat.002
By default, up to logcat.256 is stored.
Our requirement is: restart the device 1,000 times, analyze whether the restart is normal according to the log, and whether each module is loaded normally, so 1,000 logs need to be stored.
Seen from system/core/logcat/logcat.rc
# stop logcatd service and clear data
on property:logd.logpersistd.enable=true && property:logd.logpersistd=clear
setprop persist.logd.logpersistd ""
stop logcatd
# logd for clear of only our files in /data/misc/logd
exec - logd log -- /system/bin/logcat -c -f /data/misc/logd/logcat -n ${logd.logpersistd.size:-256}
setprop logd.logpersistd ""
Just configure logd.logpersistd.size in the system to 1024