Logcatd: Add new properties control logcat file size and file count.

Logcatd has capability to output logs to filesystem with certain size
and certain file count, however file size is not configurable, fixed
as 1024 kbytes, file count is configurable, but original property
name didn't match the logcat parameter well.
This patch add interface rotate_kbytes and count into logcatd.rc.
rotate_kbytes used to control each logcat file size.
count is another alias for logd.logpersistd.size to control file number.

Bug: 133362078
Test: Can use logcat -r -n with configures

Change-Id: I9954c9c125a4ab4e49310986f81c734bf8ee96b3
Signed-off-by: Tian, Baofeng <baofeng.tian@intel.com>
Signed-off-by: Duan, YayongX <yayongx.duan@intel.com>
This commit is contained in:
Tian, Baofeng 2019-05-21 11:19:12 +08:00 committed by Xihua Chen
parent 9c7a39ed2d
commit 00813a585a
2 changed files with 18 additions and 2 deletions

View file

@ -4,10 +4,15 @@
# Make sure any property changes are only performed with /data mounted, after
# post-fs-data state because otherwise behavior is undefined. The exceptions
# are device adjustments for logcatd service properties (persist.* overrides
# notwithstanding) for logd.logpersistd.size and logd.logpersistd.buffer.
# notwithstanding) for logd.logpersistd.size logd.logpersistd.rotate_kbytes and
# logd.logpersistd.buffer.
# persist to non-persistent trampolines to permit device properties can be
# overridden when /data mounts, or during runtime.
on property:persist.logd.logpersistd.count=*
# expect /init to report failure if property empty (default)
setprop persist.logd.logpersistd.size ${persist.logd.logpersistd.count}
on property:persist.logd.logpersistd.size=256
setprop persist.logd.logpersistd.size ""
setprop logd.logpersistd.size ""
@ -16,6 +21,14 @@ on property:persist.logd.logpersistd.size=*
# expect /init to report failure if property empty (default)
setprop logd.logpersistd.size ${persist.logd.logpersistd.size}
on property:persist.logd.logpersistd.rotate_kbytes=1024
setprop persist.logd.logpersistd.rotate_kbytes ""
setprop logd.logpersistd.rotate_kbytes ""
on property:persist.logd.logpersistd.rotate_kbytes=*
# expect /init to report failure if property empty (default)
setprop logd.logpersistd.rotate_kbytes ${persist.logd.logpersistd.rotate_kbytes}
on property:persist.logd.logpersistd.buffer=all
setprop persist.logd.logpersistd.buffer ""
setprop logd.logpersistd.buffer ""
@ -54,7 +67,7 @@ on property:logd.logpersistd.enable=false
stop logcatd
# logcatd service
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}
service logcatd /system/bin/logcatd -L -b ${logd.logpersistd.buffer:-all} -v threadtime -v usec -v printable -D -f /data/misc/logd/logcat -r ${logd.logpersistd.rotate_kbytes:-1024} -n ${logd.logpersistd.size:-256} --id=${ro.build.id}
class late_start
disabled
# logd for write to /data/misc/logd, log group for read from log daemon

View file

@ -17,10 +17,13 @@ logd.logpersistd string persist Enable logpersist daemon, "logcatd"
Responds to logcatd, clear and stop.
logd.logpersistd.buffer persist logpersistd buffers to collect
logd.logpersistd.size persist logpersistd size in MB
logd.logpersistd.rotate_kbytes persist logpersistd outout file size in KB.
persist.logd.logpersistd string Enable logpersist daemon, "logcatd"
turns on logcat -f in logd context.
persist.logd.logpersistd.buffer all logpersistd buffers to collect
persist.logd.logpersistd.size 256 logpersistd size in MB
persist.logd.logpersistd.count 256 sets max number of rotated logs to <count>.
persist.logd.logpersistd.rotate_kbytes 1024 logpersistd output file size in KB
persist.logd.size number ro Global default size of the buffer for
all log ids at initial startup, at
runtime use: logcat -b all -G <value>