Home | History | Annotate | Download | only in logcat
      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 
     27 on property:persist.logd.logpersistd=logcatd
     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
     35     # all exec/services are called with umask(077), so no gain beyond 0700
     36     mkdir /data/misc/logd 0700 logd log
     37     start logcatd
     38 
     39 # stop logcatd service and clear data
     40 on property:logd.logpersistd.enable=true && property:logd.logpersistd=clear
     41     setprop persist.logd.logpersistd ""
     42     stop logcatd
     43     # logd for clear of only our files in /data/misc/logd
     44     exec - logd log -- /system/bin/logcat -c -f /data/misc/logd/logcat -n ${logd.logpersistd.size:-256}
     45     setprop logd.logpersistd ""
     46 
     47 # stop logcatd service
     48 on property:logd.logpersistd=stop
     49     setprop persist.logd.logpersistd ""
     50     stop logcatd
     51     setprop logd.logpersistd ""
     52 
     53 on property:logd.logpersistd.enable=false
     54     stop logcatd
     55 
     56 # logcatd service
     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}
     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
     63     writepid /dev/cpuset/system-background/tasks
     64     oom_score_adjust -600
     65