Skip to content

Commit

Permalink
Logcatd: Add new properties control logcat file size and file count.
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Duan, YayongX <[email protected]>
  • Loading branch information
btian1 authored and xihua-chen committed May 24, 2019
1 parent 9c7a39e commit 00813a5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
17 changes: 15 additions & 2 deletions logcat/logcatd.rc
Original file line number Diff line number Diff line change
Expand Up @@ -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 ""
Expand All @@ -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 ""
Expand Down Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions logd/README.property
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit 00813a5

Please sign in to comment.