Expand logprint feature to pull out the log tag description
fields, parse them and merge into the logging content. Add
-v descriptive, -v colour(british, hidden) and -v help. Also
added a unit test for the descriptive format borrowing from
event tags that have been unchanged since 2009.
Had to add -v help because we have too many undocumented
formats and format adverbs.
Test: gTest logcat-unit-tests --gtest_filter=logcat.descriptive
Bug: 31456426
Change-Id: I93a1c003b7a3f4c332544946fdedb7277919cec3
Commit 807e40ecc9 'liblog: logd: Add
android_lookupEventTag_len()' which addressed a Dirty Shared memory
leak resulted in a regression. Most notably logcat <tag> stopped
working for the events log buffer.
AndroidLogEntry::tag also requires callers to check out
AndroidLogEntry::tagLen as tag is no longer guaranteed to be
nul terminated.
Test: logcat-unit-tests --gtest_filter=logcat.event_tag_filter
Bug: 31456426
Change-Id: Ibe5236131b640eb5b7e3df0ab4b5f3e25b85ad45
log/logger.h pieces moved into log/log.h. Correct for some
minor Android Coding standards.
Test: gTests liblog-unit-tests, logd-unit-tests and logcat-unit-tests
Bug: 19235719
Bug: 26552300
Bug: 31289077
Bug: 31456426
Change-Id: I0a19fd8788eec20a582e72e4c62c04534bdb1b9a
Provide more details regarding test failures
Test: manual, forced a failure, reports actual command issued
Bug: 30566487
Change-Id: I2431dbd335685b5eaef54ba6bd688b8588018aa9
Should use android/log.h instead of log/log.h as a good example
to all others.
Test: Compile
Bug: 26552300
Bug: 31289077
Change-Id: If4c9711eb57267d4707b03d54a932af9de241b13
Should use log/log.h and in some cases android/log.h instead. Can
not remove file because still in use by partners, so log/logd.h
points to log/log.h.
Test: Compile
Bug: 26552300
Bug: 31289077
Change-Id: I3580d46154617abb7231027a44f4ab9ee023febf
Always used in combination with log/logger.h except in log_time.cpp,
and not used externally. As a result liblog has to support stl, a
small price to pay since goal is to convert liblog to C++ internally.
Test: compile
Bug: 31456426
Bug: 26552300
Bug: 31289077
Change-Id: I72828ec807d0a2c8e40bbdebd7a69f147a7ca5a9
Specifically logcatd with exec logcat -L needs to be foreground
process cgroup as it is spawned and can block init progress. Makes
sense generally to only set background cgroup when we are taking
continuous content, and we are pushing that content to a set of
logrotate files.
Rename setupOutput to setupOutputAndSchedulingPolicy to more
clearly indicate its purpose.
Bug: 30630936
Bug: 30612424
Bug: 28788401
Change-Id: I628d590a42a53a6b448ecd0af53d6d1edf7bbb0e
Scaling issues if -f logrotation is specified and there are a lot of
log files to process in lastLogTime, focus on only the last two log
files. This will cover the situation where we have recently rotated
the logs and the last file is missing or empty.
This also alters monotonic processing as well as it used to focus on
only the last file; the danger being doubled now if the pair covers
more than one reboot when filling in missing content with logcat -L.
Problem was always there with one log file, but now we handle if
rotation happened recently. A fair tradeoff for KISS.
Bug: 30630936
Bug: 30612424
Bug: 28788401
Change-Id: I1c13b94e88f5edc08ecef52d407e296874ca5807
If a new build lands, this will automatically clear out old
logs in /data/misc/logd/ that may no longer be relevant.
Bug: 30591615
Change-Id: Iecf61bb2a4928ce4b2e8cc6a3b122b7ae598d268
Simple filter for no suffix, or a numerical suffix. toybox
grep did not handle a more robust regex, so we opted for
kiss in order to remove the .id suffix from consideration.
Bug: 30591615
Change-Id: I5b1c929d3e69c1ae39af95ae44a69f7b55e969ed
Clear file rotate content if id signature changes. This allows
logcatd to detect change of property ro.build.id to reset the
recorded data. The id is stored in the the -f filespec as
<filespec>.id.
If the id file is missing or unreadable, do not clear. Allow an
API where chmod 0 to the id file blocks this feature. Does not
work for root.
Add logcat.logrotate_id gTest.
Bug: 30591615
Change-Id: I895749ca7c6d4af57ec57f058a29d8e3af2f8b27
asprintf should be replaced with StringPrintf, solves
a memory leak issue because of exiting scope.
Bug: 30591615
Change-Id: I88644cc27946ba4f25d4539420199c6f40df1bfa
"killing Settings" is meaningless without context, we are killing the
Settings application to pull in new values, so make this clearer!
Change-Id: Ice0b950040bd05dcd49b7315def4dac3dd93eb27
Best practices so that device can set logd.logpersistd properties.
Values can be overriden with trampolines for persist.logd.logpersistd
values except as designed for empty content to keep out of the way.
This allows us to set logd.logpersistd* for a non-persistent collection
that does not survive a reboot, and to use persist.logd.logpersistd*
for persistent collection that does survive a reboot.
Added logd.logpersistd.enable to gate when logpersist service can be
run allowing the properties to be adjusted safely prior to this state
as is the case for device property.
NB: /init will complain when trying to trampoline an empty property,
this is acceptable for functionality, but may be considered
annoying from the logging perspective.
Bug: 28936216
Bug: 29831823
Change-Id: I97317e8eedfae4daa8e3ef39e64e7c5c23d8b573
- add stop and clear (and stop) actions to logcatd.rc
- use stop and clear actions in logpersist script
Bug: 28936216
Change-Id: Id05118fb51e40609fd7b3a934cf9302f67ef6d1d
If -c and -f are both specified, clear the files rather
than notifying the logger to clear its data. The -f then
acts like a switch between clearing the in-memory log
data, or the on-disk logrotate data.
Bug: 28936216
Change-Id: Ib1d1fb46ea09f81a2fd9bebb6c8f0f9f2355f6e8
Changes expected output from a line cut from the less than portable
ps output to reporting the pid of logcatd (uid=logd comm=logcat).
Preserve reporting an error code if logcatd did not start.
Bug: 29075536
Change-Id: I61aa0a4787d4594c415d2c7db5bbb0e512676bf8
- Add hidden -n and -b flags that propagate to the underlying
logcat command. Publish aliases in help as --size and --buffer.
- Add --clear for start command so it clears before starting
- shell script bloating up to deal with option validation and
provide ERROR: and WARNING: advice.
ToDo:
- Deprecate shell script and replace with Eng and Userdebug
only Developer Options, before it becomes too powerful
or bloated to force us to rewrite an expendable like this
into C++.
Bug: 28120456
Change-Id: I0dff8acaa1e5c929454760cfa2801924956bc25d
- Add property expansion to the -n/--rotate-count,
-r/--rotate-kbytes and -b/--buffer parameters.
e.g. -r '${logcat.rotate-count:-6}' will expand the property
logcat.rotate-count, and if not present will default to 6
- Add gtest to confirm mid-stream expansion
- No longer support ",:;<whitespace>" for buffer tokenization,
settling on only supporting ",".
Bug: 28120456
Change-Id: I7ebb6146f72047631536c457952fa50d0abb98ab
- Add parsing to support comma+ separated list of buffers.
- Move get_size test into a standalone get_groups function
- add some additional tests for this feature, leveraging
get_groups to confirm buffer selection.
Bug: 28120456
Change-Id: I0b42736c08cf4b2a435cb74cda540dc163a26bd1
It is not clear about the long option aliases, list
them comma separate first for clarity. Squash lines
of help content if possible. Lock to 3 indents, one
for options, another for text on same line as options
and another for next line or continuation.
Bug: 28120456
Change-Id: I5331acde3ac0fd3b87f6699ba108f6cef46a1563
- Check if the result of opendir is NULL in lastLogTime
- Cleanup: alphabetically sorted long options, reserved
an alias for --regex
- Add a unit test, non existent directory should return
gracefully with an exit(1) and not SIGSEGV.
NB: This failure was with eng/debug feature logpersist
turned on, /data/misc/logd/ directory was missing,
deleted, or temporarily inaccessible.
Bug: 27954627
Change-Id: I60246a53b02fdd7e5490fe458b02ad7b14843584
To be used in combination with --regex and --max-count flags
to allow all prints to pass through, but still stop when
max-count is hit.
Bug: 27706081
Change-Id: Idaa9f0b44586a885b9d9f367824b0072c0853227
- change _ to - for long arguments
- added --tail as hidden undocumented alias for -t
- added --head as hidden undocumented alias for --max-count
Bug: 27706081
Change-Id: I614cc83ae56b305b267f64ed05dc3ed3027dabd4
- Do not restrict regex on LOG_ID_EVENTS or LOG_ID_SECURITY.
- some logcat_panic messages need to incorporate a newline.
- deal with some coding standards issues.
Bug: 27706081
Change-Id: Ie647fd62d027b01004177559d68b8e5a346705e6
This new option causes logcat to quit after it prints N messages.
Test: New unit test passes
Bug: 27706081
Change-Id: Ie52ddf300160a041e68a6bac0ae7ade68bb28a7c
You can now filter log output by a regex on the messages.
Test: New unit test passes
Bug: 27706081
Change-Id: Idfa637f62a25fb1b92e9b49b89572dff0fec6e08