Mark Salyzyn | df5d128 | 2016-07-07 09:24:51 -0700 | [diff] [blame] | 1 | # |
| 2 | # init scriptures for logcatd persistent logging. |
| 3 | # |
| 4 | # Make sure any property changes are only performed with /data mounted, after |
| 5 | # post-fs-data state because otherwise behavior is undefined. The exceptions |
| 6 | # are device adjustments for logcatd service properties (persist.* overrides |
| 7 | # notwithstanding) for logd.logpersistd.size and logd.logpersistd.buffer. |
| 8 | |
| 9 | # persist to non-persistent trampolines to permit device properties can be |
| 10 | # overridden when /data mounts, or during runtime. |
| 11 | on property:persist.logd.logpersistd.size=256 |
| 12 | setprop persist.logd.logpersistd.size "" |
| 13 | setprop logd.logpersistd.size "" |
| 14 | |
| 15 | on property:persist.logd.logpersistd.size=* |
| 16 | # expect /init to report failure if property empty (default) |
| 17 | setprop logd.logpersistd.size ${persist.logd.logpersistd.size} |
| 18 | |
| 19 | on property:persist.logd.logpersistd.buffer=all |
| 20 | setprop persist.logd.logpersistd.buffer "" |
| 21 | setprop logd.logpersistd.buffer "" |
| 22 | |
| 23 | on property:persist.logd.logpersistd.buffer=* |
| 24 | # expect /init to report failure if property empty (default) |
| 25 | setprop logd.logpersistd.buffer ${persist.logd.logpersistd.buffer} |
| 26 | |
Tom Cherry | 20391b1 | 2015-08-14 13:02:51 -0700 | [diff] [blame] | 27 | on property:persist.logd.logpersistd=logcatd |
Mark Salyzyn | df5d128 | 2016-07-07 09:24:51 -0700 | [diff] [blame] | 28 | setprop logd.logpersistd logcatd |
| 29 | |
| 30 | # enable, prep and start logcatd service |
| 31 | on load_persist_props_action |
| 32 | setprop logd.logpersistd.enable true |
| 33 | |
| 34 | on property:logd.logpersistd.enable=true && property:logd.logpersistd=logcatd |
Tom Cherry | 20391b1 | 2015-08-14 13:02:51 -0700 | [diff] [blame] | 35 | # all exec/services are called with umask(077), so no gain beyond 0700 |
| 36 | mkdir /data/misc/logd 0700 logd log |
| 37 | # logd for write to /data/misc/logd, log group for read from pstore (-L) |
Ruchi Kandoi | 90a3f81 | 2016-06-14 15:26:30 -0700 | [diff] [blame] | 38 | # b/28788401 b/30041146 b/30612424 |
Mark Salyzyn | c91c444 | 2016-08-08 13:10:35 -0700 | [diff] [blame] | 39 | # exec - logd log -- /system/bin/logcat -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} |
Tom Cherry | 20391b1 | 2015-08-14 13:02:51 -0700 | [diff] [blame] | 40 | start logcatd |
| 41 | |
Mark Salyzyn | df5d128 | 2016-07-07 09:24:51 -0700 | [diff] [blame] | 42 | # stop logcatd service and clear data |
| 43 | on property:logd.logpersistd.enable=true && property:logd.logpersistd=clear |
| 44 | setprop persist.logd.logpersistd "" |
Mark Salyzyn | 2d73701 | 2016-06-06 11:22:13 -0700 | [diff] [blame] | 45 | stop logcatd |
| 46 | # logd for clear of only our files in /data/misc/logd |
Mark Salyzyn | df5d128 | 2016-07-07 09:24:51 -0700 | [diff] [blame] | 47 | exec - logd log -- /system/bin/logcat -c -f /data/misc/logd/logcat -n ${logd.logpersistd.size:-256} |
| 48 | setprop logd.logpersistd "" |
Mark Salyzyn | 2d73701 | 2016-06-06 11:22:13 -0700 | [diff] [blame] | 49 | |
Mark Salyzyn | df5d128 | 2016-07-07 09:24:51 -0700 | [diff] [blame] | 50 | # stop logcatd service |
| 51 | on property:logd.logpersistd=stop |
| 52 | setprop persist.logd.logpersistd "" |
Mark Salyzyn | 2d73701 | 2016-06-06 11:22:13 -0700 | [diff] [blame] | 53 | stop logcatd |
Mark Salyzyn | df5d128 | 2016-07-07 09:24:51 -0700 | [diff] [blame] | 54 | setprop logd.logpersistd "" |
Mark Salyzyn | 2d73701 | 2016-06-06 11:22:13 -0700 | [diff] [blame] | 55 | |
Mark Salyzyn | df5d128 | 2016-07-07 09:24:51 -0700 | [diff] [blame] | 56 | on property:logd.logpersistd.enable=false |
| 57 | stop logcatd |
| 58 | |
| 59 | # logcatd service |
Mark Salyzyn | 9b35df6 | 2016-08-03 15:17:06 -0700 | [diff] [blame] | 60 | service logcatd /system/bin/logcat -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} |
Tom Cherry | 20391b1 | 2015-08-14 13:02:51 -0700 | [diff] [blame] | 61 | class late_start |
| 62 | disabled |
| 63 | # logd for write to /data/misc/logd, log group for read from log daemon |
| 64 | user logd |
| 65 | group log |
Tom Cherry | 984bd83 | 2015-09-21 14:25:34 -0700 | [diff] [blame] | 66 | writepid /dev/cpuset/system-background/tasks |