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 |
Tom Cherry | 20391b1 | 2015-08-14 13:02:51 -0700 | [diff] [blame] | 37 | start logcatd |
| 38 | |
Mark Salyzyn | df5d128 | 2016-07-07 09:24:51 -0700 | [diff] [blame] | 39 | # stop logcatd service and clear data |
| 40 | on property:logd.logpersistd.enable=true && property:logd.logpersistd=clear |
| 41 | setprop persist.logd.logpersistd "" |
Mark Salyzyn | 2d73701 | 2016-06-06 11:22:13 -0700 | [diff] [blame] | 42 | stop logcatd |
| 43 | # logd for clear of only our files in /data/misc/logd |
Mark Salyzyn | df5d128 | 2016-07-07 09:24:51 -0700 | [diff] [blame] | 44 | exec - logd log -- /system/bin/logcat -c -f /data/misc/logd/logcat -n ${logd.logpersistd.size:-256} |
| 45 | setprop logd.logpersistd "" |
Mark Salyzyn | 2d73701 | 2016-06-06 11:22:13 -0700 | [diff] [blame] | 46 | |
Mark Salyzyn | df5d128 | 2016-07-07 09:24:51 -0700 | [diff] [blame] | 47 | # stop logcatd service |
| 48 | on property:logd.logpersistd=stop |
| 49 | setprop persist.logd.logpersistd "" |
Mark Salyzyn | 2d73701 | 2016-06-06 11:22:13 -0700 | [diff] [blame] | 50 | stop logcatd |
Mark Salyzyn | df5d128 | 2016-07-07 09:24:51 -0700 | [diff] [blame] | 51 | setprop logd.logpersistd "" |
Mark Salyzyn | 2d73701 | 2016-06-06 11:22:13 -0700 | [diff] [blame] | 52 | |
Mark Salyzyn | df5d128 | 2016-07-07 09:24:51 -0700 | [diff] [blame] | 53 | on property:logd.logpersistd.enable=false |
| 54 | stop logcatd |
| 55 | |
| 56 | # logcatd service |
Mark Salyzyn | a073c39 | 2017-04-03 09:30:20 -0700 | [diff] [blame] | 57 | 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} |
Tom Cherry | 20391b1 | 2015-08-14 13:02:51 -0700 | [diff] [blame] | 58 | class late_start |
| 59 | disabled |
| 60 | # logd for write to /data/misc/logd, log group for read from log daemon |
| 61 | user logd |
| 62 | group log |
Tom Cherry | 984bd83 | 2015-09-21 14:25:34 -0700 | [diff] [blame] | 63 | writepid /dev/cpuset/system-background/tasks |
Mark Salyzyn | 30ea96e | 2017-05-30 09:01:38 -0700 | [diff] [blame] | 64 | oom_score_adjust -600 |