blob: 07040b01df2aded9676a70dd67509b6b3c274a44 [file] [log] [blame]
Mark Salyzyndf5d1282016-07-07 09:24:51 -07001#
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.
11on property:persist.logd.logpersistd.size=256
12 setprop persist.logd.logpersistd.size ""
13 setprop logd.logpersistd.size ""
14
15on 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
19on property:persist.logd.logpersistd.buffer=all
20 setprop persist.logd.logpersistd.buffer ""
21 setprop logd.logpersistd.buffer ""
22
23on 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 Cherry20391b12015-08-14 13:02:51 -070027on property:persist.logd.logpersistd=logcatd
Mark Salyzyndf5d1282016-07-07 09:24:51 -070028 setprop logd.logpersistd logcatd
29
30# enable, prep and start logcatd service
31on load_persist_props_action
32 setprop logd.logpersistd.enable true
33
34on property:logd.logpersistd.enable=true && property:logd.logpersistd=logcatd
Tom Cherry20391b12015-08-14 13:02:51 -070035 # all exec/services are called with umask(077), so no gain beyond 0700
36 mkdir /data/misc/logd 0700 logd log
Tom Cherry20391b12015-08-14 13:02:51 -070037 start logcatd
38
Mark Salyzyndf5d1282016-07-07 09:24:51 -070039# stop logcatd service and clear data
40on property:logd.logpersistd.enable=true && property:logd.logpersistd=clear
41 setprop persist.logd.logpersistd ""
Mark Salyzyn2d737012016-06-06 11:22:13 -070042 stop logcatd
43 # logd for clear of only our files in /data/misc/logd
Mark Salyzyndf5d1282016-07-07 09:24:51 -070044 exec - logd log -- /system/bin/logcat -c -f /data/misc/logd/logcat -n ${logd.logpersistd.size:-256}
45 setprop logd.logpersistd ""
Mark Salyzyn2d737012016-06-06 11:22:13 -070046
Mark Salyzyndf5d1282016-07-07 09:24:51 -070047# stop logcatd service
48on property:logd.logpersistd=stop
49 setprop persist.logd.logpersistd ""
Mark Salyzyn2d737012016-06-06 11:22:13 -070050 stop logcatd
Mark Salyzyndf5d1282016-07-07 09:24:51 -070051 setprop logd.logpersistd ""
Mark Salyzyn2d737012016-06-06 11:22:13 -070052
Mark Salyzyndf5d1282016-07-07 09:24:51 -070053on property:logd.logpersistd.enable=false
54 stop logcatd
55
56# logcatd service
Mark Salyzyna073c392017-04-03 09:30:20 -070057service 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 Cherry20391b12015-08-14 13:02:51 -070058 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 Cherry984bd832015-09-21 14:25:34 -070063 writepid /dev/cpuset/system-background/tasks
Mark Salyzyn30ea96e2017-05-30 09:01:38 -070064 oom_score_adjust -600