558282bfe4
logcatd is the same as logcat, except that the -L flag, if supplied, runs once, then the command re-runs itself without the -L flag with the same argument set. By introducing a logcatd daemon executable we can solve the problem of the longish reads from pstore that sometimes occur when the system is excessively busy, starving this background cgroup daemon as we absorb the delay in a backgrounded init "service", rather than in a forgrounded init "exec". This would not have been efficiently possible without the introduction of liblogcat. There are no doubt many flags that make no sense to run twice with, and without, the -L flag. In the general sense we expect the caller to perform the correct set of operations and not pick these nonsense operations. logcatd is only supplied on engineering and debug builds for logpersist, and is only an automated aid to triage. Test: gTest logcat-unit-tests Test: manual confirm logpersist functions as expected, required reboot Bug: 28788401 Bug: 30041146 Bug: 30612424 Bug: 35326290 Change-Id: I53ba31970749daf37eef42636f039f485932416f
63 lines
2.4 KiB
Text
63 lines
2.4 KiB
Text
#
|
|
# init scriptures for logcatd persistent logging.
|
|
#
|
|
# Make sure any property changes are only performed with /data mounted, after
|
|
# post-fs-data state because otherwise behavior is undefined. The exceptions
|
|
# are device adjustments for logcatd service properties (persist.* overrides
|
|
# notwithstanding) for logd.logpersistd.size and logd.logpersistd.buffer.
|
|
|
|
# persist to non-persistent trampolines to permit device properties can be
|
|
# overridden when /data mounts, or during runtime.
|
|
on property:persist.logd.logpersistd.size=256
|
|
setprop persist.logd.logpersistd.size ""
|
|
setprop logd.logpersistd.size ""
|
|
|
|
on property:persist.logd.logpersistd.size=*
|
|
# expect /init to report failure if property empty (default)
|
|
setprop logd.logpersistd.size ${persist.logd.logpersistd.size}
|
|
|
|
on property:persist.logd.logpersistd.buffer=all
|
|
setprop persist.logd.logpersistd.buffer ""
|
|
setprop logd.logpersistd.buffer ""
|
|
|
|
on property:persist.logd.logpersistd.buffer=*
|
|
# expect /init to report failure if property empty (default)
|
|
setprop logd.logpersistd.buffer ${persist.logd.logpersistd.buffer}
|
|
|
|
on property:persist.logd.logpersistd=logcatd
|
|
setprop logd.logpersistd logcatd
|
|
|
|
# enable, prep and start logcatd service
|
|
on load_persist_props_action
|
|
setprop logd.logpersistd.enable true
|
|
|
|
on property:logd.logpersistd.enable=true && property:logd.logpersistd=logcatd
|
|
# all exec/services are called with umask(077), so no gain beyond 0700
|
|
mkdir /data/misc/logd 0700 logd log
|
|
start logcatd
|
|
|
|
# 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 ""
|
|
|
|
# stop logcatd service
|
|
on property:logd.logpersistd=stop
|
|
setprop persist.logd.logpersistd ""
|
|
stop logcatd
|
|
setprop logd.logpersistd ""
|
|
|
|
on property:logd.logpersistd.enable=false
|
|
stop logcatd
|
|
|
|
# logcatd service
|
|
service logcatd /system/bin/logcatd -L -b ${logd.logpersistd.buffer:-all} -v threadtime -v usec -v printable -D -f /data/misc/logd/logcat -r 1024 -n ${logd.logpersistd.size:-256} --id=${ro.build.id}
|
|
class late_start
|
|
disabled
|
|
# logd for write to /data/misc/logd, log group for read from log daemon
|
|
user logd
|
|
group log
|
|
writepid /dev/cpuset/system-background/tasks
|