2016-07-07 18:24:51 +02:00
|
|
|
#
|
|
|
|
# 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}
|
|
|
|
|
2015-08-14 22:02:51 +02:00
|
|
|
on property:persist.logd.logpersistd=logcatd
|
2016-07-07 18:24:51 +02:00
|
|
|
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
|
2015-08-14 22:02:51 +02:00
|
|
|
# all exec/services are called with umask(077), so no gain beyond 0700
|
|
|
|
mkdir /data/misc/logd 0700 logd log
|
|
|
|
start logcatd
|
|
|
|
|
2016-07-07 18:24:51 +02:00
|
|
|
# stop logcatd service and clear data
|
|
|
|
on property:logd.logpersistd.enable=true && property:logd.logpersistd=clear
|
|
|
|
setprop persist.logd.logpersistd ""
|
2016-06-06 20:22:13 +02:00
|
|
|
stop logcatd
|
|
|
|
# logd for clear of only our files in /data/misc/logd
|
2016-07-07 18:24:51 +02:00
|
|
|
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
|
2016-06-06 20:22:13 +02:00
|
|
|
setprop persist.logd.logpersistd ""
|
2016-07-07 18:24:51 +02:00
|
|
|
stop logcatd
|
|
|
|
setprop logd.logpersistd ""
|
2016-06-06 20:22:13 +02:00
|
|
|
|
2016-07-07 18:24:51 +02:00
|
|
|
on property:logd.logpersistd.enable=false
|
2016-06-06 20:22:13 +02:00
|
|
|
stop logcatd
|
|
|
|
|
2016-07-07 18:24:51 +02:00
|
|
|
# logcatd service
|
logcatd: introduce logcatd executable
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
2017-04-03 18:30:20 +02:00
|
|
|
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}
|
2015-08-14 22:02:51 +02:00
|
|
|
class late_start
|
|
|
|
disabled
|
|
|
|
# logd for write to /data/misc/logd, log group for read from log daemon
|
|
|
|
user logd
|
|
|
|
group log
|
2015-09-21 23:25:34 +02:00
|
|
|
writepid /dev/cpuset/system-background/tasks
|
2017-05-30 18:01:38 +02:00
|
|
|
oom_score_adjust -600
|