For the gTests logcat.tz, logcat.tail_3, logcat.tail_10,
logcat.tail_100, logcat.tail_1000 and logcat.tail_time tests inject
messages if we come up short should the background logging not be
sufficient to feed the test requirements. Test frames run the
tests right after reboot requiring injection. Will have radio
silence, so we also add kernel logs if available to help add to the
background logging activity level.
We also will inject a radio message for logcat.buckets so that test
can survive no radio content.
Test: set device to airplane mode (to stress this problem) then:
adb logcat -b all -c && adb shell su root \
/data/nativetest/logcat-unit-tests/logcat-unit-tests \
--gtest_filter=logcat.tail_1000 (or others in this set)
Bug: 34454772
Change-Id: I5ec246552f3ab1fc9c5864ed69d63b851fdf538d
Do not report security buffer errors if not specifically
named in the buffer list.
Test: gTest logcat-unit-test --gtest_filter=logcat.security
Bug: 34511645
Change-Id: I028d51abad0329fcf42e467b135d035b06c1d2e3
logd now counts multiple identical messages, causing messages to be
held back. Stop doing that in the tests. When that filter appeared,
the logcat-unit-tests went from 23 seconds to a couple of minutes of
runtime breakign the automated testing.
Test: gTest logcat-unit-tests total time less than 1 minute.
Bug: 33845198
Bug: 33535908
Change-Id: I6145bae89b6d5e5024ef4f8fe66440c9ae53f7c6
NULL represents system default. In the future, NULL could represent
static and dynamic tags, which can come from multiple files based on
implementation details in the liblog library.
Test: gTest logd-unit-tests & liblog-unit-tests
Bug: 31456426
Change-Id: I0e3d296de81ca299ae63d7b83781639ee67ec298
rename class from android_log_event_context to android_log_event_list
Test: gTest logcat-unit-tests
Bug: 31992412
Bug: 31456426
Change-Id: Ib61cbca7d453837d64959c56b0e11f8c5edbfbdd
We need to accept that a log tag can contain no payload. For those
that are corrupted, and to aid debugging, report what we did manage
to interpret. Report last character as a ! for corruption, and ^
for truncation. Fix a few Android Coding standard issues.
Test: gTest logcat-unit-tests
Bug: 32903864
Change-Id: Id11bef3a7b6569305c51701dd66c45d2038d6628
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
(cherry pick from 2591d483c8)
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: 28788401
Bug: 28813587
Bug: 28936216
Bug: 29831823
Change-Id: I97317e8eedfae4daa8e3ef39e64e7c5c23d8b573
(cherry pick from commit 4517773296)
- 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
Bug: 28788401
Bug: 28813587
Change-Id: I0b42736c08cf4b2a435cb74cda540dc163a26bd1
(cherry pick from commit b7d059bb2f)
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: 28788401
Bug: 28813587
Bug: 28936216
Change-Id: Ib1d1fb46ea09f81a2fd9bebb6c8f0f9f2355f6e8
(cherry pick from commit 378f4745a2)
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
Bug: 28788401
Bug: 28813587
Change-Id: I5331acde3ac0fd3b87f6699ba108f6cef46a1563