• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.
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
27on property:persist.logd.logpersistd=logcatd
28    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
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)
38    # b/28788401 b/30041146 b/30612424
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}
40    start logcatd
41
42# stop logcatd service and clear data
43on property:logd.logpersistd.enable=true && property:logd.logpersistd=clear
44    setprop persist.logd.logpersistd ""
45    stop logcatd
46    # logd for clear of only our files in /data/misc/logd
47    exec - logd log -- /system/bin/logcat -c -f /data/misc/logd/logcat -n ${logd.logpersistd.size:-256}
48    setprop logd.logpersistd ""
49
50# stop logcatd service
51on property:logd.logpersistd=stop
52    setprop persist.logd.logpersistd ""
53    stop logcatd
54    setprop logd.logpersistd ""
55
56on property:logd.logpersistd.enable=false
57    stop logcatd
58
59# logcatd service
60service 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}
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
66    writepid /dev/cpuset/system-background/tasks
67