Commit graph

259 commits

Author SHA1 Message Date
Mark Salyzyn
c91c4446a6 resolve merge conflicts of 5f6dbd9 to nyc-mr1-dev-plus-aosp
Change-Id: Ia85ca9ea4c38d270229af394c351b7b31ea2057e
2016-08-08 13:10:35 -07:00
Mark Salyzyn
8065220686 Merge "logcatd: logpersist.start more descriptive warning" am: dad158f3a1 am: 2c1322f751
am: dbfe0a1abe

Change-Id: I460f84979b743a341de4265f398b53cea8724e49
2016-08-08 18:36:12 +00:00
Mark Salyzyn
ad5e411608 logcat: -d, -t or -L, along with -f, do not background
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
2016-08-08 10:20:22 -07:00
Mark Salyzyn
31961061d5 logcat: lastLogTime only two most recent files
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
2016-08-08 10:20:22 -07:00
Mark Salyzyn
9b35df6517 logcatd: Add --id=${ro.build.id}
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
2016-08-08 10:20:22 -07:00
Mark Salyzyn
2e5b71873c logcatd: fix up logpersist.cat to filter out signature file
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
2016-08-08 10:20:22 -07:00
Mark Salyzyn
02687e75b0 logcat: add --id=<id> for -f option
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
2016-08-08 10:19:48 -07:00
Mark Salyzyn
5b1a538fc8 logcat: switch to android::base::StringPrintf
asprintf should be replaced with StringPrintf, solves
a memory leak issue because of exiting scope.

Bug: 30591615
Change-Id: I88644cc27946ba4f25d4539420199c6f40df1bfa
2016-08-08 10:03:14 -07:00
Mark Salyzyn
452eaf7d5b logcatd: logpersist.start more descriptive warning
"killing Settings" is meaningless without context, we are killing the
Settings application to pull in new values, so make this clearer!

Change-Id: Ice0b950040bd05dcd49b7315def4dac3dd93eb27
2016-08-08 10:03:05 -07:00
Ruchi Kandoi
dc4c1654b5 logd: logcat -L takes longer causing vold to timeout. am: 90a3f81c9e
am: 366513fc3f

Change-Id: Iab79f34aa6655295672fdd53dca7cef58b2574ee
2016-08-03 22:21:44 +00:00
Ruchi Kandoi
90a3f81c9e logd: logcat -L takes longer causing vold to timeout.
Temporary fix to prevent device from getting stuck at boot.

Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com>
Bug: 28788401
Bug: 30041146
Bug: 30612424
Bug: 30630936
Change-Id: Ie4246fc3c9eb7a3af2cb909546811c85997515da
2016-08-03 20:27:02 +00:00
Mark Salyzyn
6a7bfd8749 logcatd: logpersist.start to enable logd service if disabled
Bug: 28936216
Change-Id: I2f2878f138be6675bf00bd638df2bdd690a1fae5
2016-07-21 14:19:39 -07:00
Mark Salyzyn
df5d12850a logcatd: trampoline persist.logd.logpersistd to logd.logpersistd
(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
2016-07-19 11:13:14 -07:00
Mark Salyzyn
2d737011d6 logcatd: add stop and clear actions
(cherry pick from commit cd5118bf1e)

- add stop and clear (and stop) actions to logcatd.rc
- use stop and clear actions in logpersist script

Bug: 28788401
Bug: 28813587
Bug: 28936216
Change-Id: Id05118fb51e40609fd7b3a934cf9302f67ef6d1d
2016-07-19 11:13:14 -07:00
Mark Salyzyn
befa79d7e0 logcatd: Do not su for setprop
(cherry pick from commit 8d2a65572b)

sepolicy now permits setting persist.logd.logpersistd in shell

Bug: 28788401
Bug: 28813587
Bug: 28936216
Change-Id: Ieed50eae0f91afa5b0c0e4ade7a71922c4b7ef93
2016-07-19 11:13:14 -07:00
Mark Salyzyn
7545b471a2 logcat: allow comma-separate list of buffers
(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
2016-07-19 11:13:14 -07:00
Mark Salyzyn
c869959d62 logcat: clear when specifying file output
(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
2016-07-19 11:13:14 -07:00
Mark Salyzyn
3f6777a3dd logcat: Adjust help to make it more meaningful
(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
2016-07-19 11:13:10 -07:00
Mark Salyzyn
515f091f5e logpersist: incorporate size and buffer tunables
- 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
Bug: 28788401
Change-Id: I0dff8acaa1e5c929454760cfa2801924956bc25d
2016-07-13 23:53:54 +00:00
Thierry Strudel
aa3a56539d Revert "logd: logcat -L takes longer causing vold to timeout."
This reverts commit c1b26acae2.

Bug: 28788401
Change-Id: I415530deb7587d1068f42971762b418b0524663c
2016-07-13 23:53:10 +00:00
Mark Salyzyn
2591d483c8 logcatd: trampoline persist.logd.logpersistd to logd.logpersistd
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
2016-07-08 11:06:06 -07:00
Mark Salyzyn
e735a7305b logcat: help spelling correction
threadtime and added clarity for adverbs

Bug: 29916087
Change-Id: Idbed8bc74147c105eaced940d035d0649a244b18
2016-07-06 13:33:57 -07:00
Mark Salyzyn
9cfd1c6ebc logcat: format verbs and adverbs
Bug: 29916087
Change-Id: I039c95b9dc0aa88f1219121513899934381453ae
2016-07-06 11:16:07 -07:00
Ruchi Kandoi
c1b26acae2 logd: logcat -L takes longer causing vold to timeout.
Temporary fix to prevent device from getting stuck at boot.

Bug: 28788401
Change-Id: Ie4246fc3c9eb7a3af2cb909546811c85997515da
Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com>
2016-06-14 15:26:30 -07:00
Mark Salyzyn
cd5118bf1e logcatd: add stop and clear actions
- add stop and clear (and stop) actions to logcatd.rc
- use stop and clear actions in logpersist script

Bug: 28936216
Change-Id: Id05118fb51e40609fd7b3a934cf9302f67ef6d1d
2016-06-10 21:43:16 +00:00
Mark Salyzyn
8d2a65572b logcatd: Do not su for setprop
sepolicy now permits setting persist.logd.logpersistd in shell

Bug: 28936216
2016-06-10 21:42:47 +00:00
Mark Salyzyn
b7d059bb2f logcat: clear when specifying file output
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
2016-06-10 18:10:01 +00:00
Mark Salyzyn
1325ebfab2 Revert "logcat: expand -n, -r and -b"
This reverts commit 33c262513f.

Bug: 28120456
Bug: 22654233
Change-Id: I2a13f009d9e08dc2389b9872e45e95e0563af22f
2016-06-08 08:22:19 -07:00
Mark Salyzyn
1d945119c0 logpersist: switch to pgrep from ps
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
2016-06-02 09:51:13 -07:00
Mark Salyzyn
e7e5f1b6ae logcat: confirm -g result after -c
Bug: 28451229
Change-Id: I43a1721ae991cc1316335ba4b3b868b904926d42
2016-04-29 11:33:26 -07:00
Chih-Hung Hsieh
1cc82ce95c Fix google-explicit-constructor warnings.
Bug: 28341362
Change-Id: I2cf746fd07addc6e6c22e98e2a5bb8a8ce47c885
2016-04-25 13:49:46 -07:00
Mark Salyzyn
2e210e4650 logpersist: incorporate size and buffer tunables
- 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
2016-04-18 08:54:39 -07:00
Mark Salyzyn
3c535de75e logcat: apct test failures
(cherry pick from 3842b1a5f6)

Change-Id: I100a5071c059fe9fa85bbdc33db552b16d7bdf60
2016-04-15 16:38:42 +00:00
Mark Salyzyn
33c262513f logcat: expand -n, -r and -b
- 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
2016-04-13 11:43:03 -07:00
Mark Salyzyn
4517773296 logcat: allow comma-separate list of buffers
- 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
2016-04-13 11:42:57 -07:00
Mark Salyzyn
378f4745a2 logcat: Adjust help to make it more meaningful
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
2016-04-13 11:42:52 -07:00
Mark Salyzyn
3842b1a5f6 logcat: apct test failures
Bug: 27241615
Change-Id: I100a5071c059fe9fa85bbdc33db552b16d7bdf60
2016-04-12 22:36:04 +00:00
Mark Salyzyn
1ab87e7712 logcat: -f <non-existent-directory>/<filename> segfaults
(cherry pick from commit c18c2130d0)

- 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
2016-04-01 12:54:10 -07:00
Mark Salyzyn
c18c2130d0 logcat: -f <non-existent-directory>/<filename> segfaults
- 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
2016-04-01 09:42:32 -07:00
Mark Salyzyn
3bef8973aa logcat: add --print flag
(cherry pick from commit c9202777cf)

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
2016-03-30 16:31:35 -07:00
Mark Salyzyn
7ec59405ce logcat: posixize and extend long arguments
(cherry pick from commit d85f6461b6)

- 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
2016-03-30 16:29:56 -07:00
Mark Salyzyn
df42ce4cf3 logcat: support --regex on binary buffers as-is
(cherry pick from commit aa730c1145)

- 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
2016-03-30 16:28:34 -07:00
Mark Salyzyn
9cc9cf0280 logcat: do not assign 0 or NULL to global variables
(cherry pick from commit c6d6652df5)

Bug: 27706081
Change-Id: If29d8d688ca7cce9b22227eeff1e9b500e728a50
2016-03-30 16:27:18 -07:00
Casey Dahlin
1164ef6a73 logcat: Add --max-count option
(cherry pick from commit 6ac498d4bb)

This new option causes logcat to quit after it prints N messages.

Test: New unit test passes
Bug: 27706081
Change-Id: Ie52ddf300160a041e68a6bac0ae7ade68bb28a7c
2016-03-30 16:25:40 -07:00
Casey Dahlin
0f7732d708 logcat: Add --regex option
(cherry pick from commit dc42a8734e)

You can now filter log output by a regex on the messages.

Test: New unit test passes
Bug: 27706081
Change-Id: Idfa637f62a25fb1b92e9b49b89572dff0fec6e08
2016-03-30 16:24:26 -07:00
Mark Salyzyn
c9202777cf logcat: add --print flag
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
2016-03-30 16:11:37 -07:00
Mark Salyzyn
d85f6461b6 logcat: posixize and extend long arguments
- 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
2016-03-30 16:11:37 -07:00
Mark Salyzyn
aa730c1145 logcat: support --regex on binary buffers as-is
- 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
2016-03-30 16:11:37 -07:00
Mark Salyzyn
c6d6652df5 logcat: do not assign 0 or NULL to global variables
Bug: 27706081
Change-Id: If29d8d688ca7cce9b22227eeff1e9b500e728a50
2016-03-30 16:11:37 -07:00
Casey Dahlin
6ac498d4bb logcat: Add --max-count option
This new option causes logcat to quit after it prints N messages.

Test: New unit test passes
Bug: 27706081
Change-Id: Ie52ddf300160a041e68a6bac0ae7ade68bb28a7c
2016-03-25 13:55:29 -07:00
Casey Dahlin
dc42a8734e logcat: Add --regex option
You can now filter log output by a regex on the messages.

Test: New unit test passes
Bug: 27706081
Change-Id: Idfa637f62a25fb1b92e9b49b89572dff0fec6e08
2016-03-25 13:55:29 -07:00
James Hawkins
588a2cad7f system/core: Cleanup direct calls to opendir by containing in a
std::unique_ptr.

Bug: 26643633
Change-Id: Ia3491fdbff086558da694ae949cf08e4c89d0307
2016-02-18 14:52:46 -08:00
Elliott Hughes
b9e53b4d2d Remove logcat's false dependency on a libutils header file.
Change-Id: Idf499d77e88d2ee7d5b1050eaf45ba29481793a4
2016-02-17 11:58:01 -08:00
Mark Salyzyn
d1f41d606b logd: use ro.debuggable instead of ro.build.type
Change-Id: Ic644f1f78e68094f700834675f4acc63386a6b92
2016-02-10 10:23:03 -08:00
Mark Salyzyn
5b89b49fc9 logcat: build cleanup
LOCAL_MODULE_TAGS debug encompasses eng

Bug: 26976972
Change-Id: I44b30f2ebb0173b203bf975f01dfead737b4e5bf
2016-02-04 13:10:19 -08:00
Mark Salyzyn
6de62e52c7 logcatd.rc: only deliver on eng and userdebug
Change-Id: I694d33a041e40fe181d3c2f1c8604765ba29e709
2016-02-04 11:11:52 -08:00
Mark Salyzyn
3bab2a9096 logpersist: missing X
Signed-off-by: LawrenceSY_Kuo@asus.com
Bug: 19608716
Change-Id: I90e0313262a02906dec71417b995fc725f78a292
2015-12-29 07:31:37 -08:00
Mark Salyzyn
8beb0d3ad7 logcat: test: rotated logs can exceed size during crash
Some crash messages can be as large as 4K, so allow
the rotated logs to have a larger size.

Change-Id: I20ef8d526ad2d5eca128d1f99f4ea2d2da426403
2015-12-18 10:35:20 -08:00
Mark Salyzyn
86052a5d4f Merge "logd: liblog: logcat: Add LOG_ID_SECURITY" 2015-12-11 17:33:33 +00:00
Mark Salyzyn
90e7af30a5 liblog: logprint add uid format modifier
Bug: 25996918
Change-Id: Idff5e080fc5c7b69e0c45d3f596eb9d632451cbd
2015-12-09 08:12:07 -08:00
Mark Salyzyn
083b037c07 logd: liblog: logcat: Add LOG_ID_SECURITY
- Largish commit, buffer and access controls done together
- Add LOG_ID_SECURITY binary content log
- Add "default" meta buffer
- allow LOG_ID_SECURITY only from AID_SYSTEM and AID_ROOT UID & GID
- Use __android_log_security() to gate logging
- Add __android_log_security_bwrite() native access to security
  logging.
- Add liblog.__security_buffer end-to-end gTest

Bug: 26029733
Change-Id: Ibcf5b4660c17c1aa6902c0d93f8ffd29c93d9a93
2015-12-08 16:46:29 -08:00
Mark Salyzyn
41ba25f864 logcat: Add --wrap timeout
Always ANDROID_LOG_WRAP_DEFAULT_TIMEOUT seconds (2 hours).
--wrap takes argument, the argument is currently ignored.

Future: Add new API that allows setting of wrap timeout.

Bug: 25929746
Bug: 21615139
Change-Id: Ib441cecfb6e4264c18adb70c705314440ba85e65
2015-12-07 14:24:02 -08:00
Mark Salyzyn
f8bff87c65 logcat: Add low hanging fruit long arguments
Add long arguments file, rotate_kbytes, rotate_count, format,
dividers, clear, buffer_size, last, buffer, binary, statistics
and prune.

Bug: 21615139
Change-Id: Ieb1bbe3d47e6711a1e91c74522630d39f8981621
2015-12-07 14:24:02 -08:00
Kristian Monsen
562e513d4b logcat: Add long arguments to logcat, support for pid filter
Bug: 21615139
Change-Id: I3e63e43067f8089c18658e4100e901fb2a9630ae
2015-12-07 14:24:02 -08:00
Mark Salyzyn
ba7a9a016b logd: liblog: logcat: switch to android_log_clockid() (2)
android_log_timestamp returns the property leading letter,
it is better to return a clockid_t with android_log_clockid()

Bug: 23668800
Change-Id: I38dee773bf3844177826b03a26b03215c79a5359
2015-12-07 18:45:31 +00:00
Mark Salyzyn
b566435b02 Merge "Revert "logd: liblog: logcat: switch to android_log_clockid()"" 2015-12-07 18:31:44 +00:00
Mark Salyzyn
9e18cdcebd Revert "logd: liblog: logcat: switch to android_log_clockid()"
This reverts commit 77b5696b1d.

Change-Id: I7711bf1a7e3f72ed29a2498d7287b725a0e624bd
2015-12-07 18:30:58 +00:00
Mark Salyzyn
9eca0e775b Merge "logd: liblog: logcat: switch to android_log_clockid()" 2015-12-07 18:16:29 +00:00
Elliott Hughes
4f71319df0 Track rename of base/ to android-base/.
Change-Id: Idf9444fece4aa89c93e15640de59a91f6e758ccf
2015-12-04 22:00:26 -08:00
Mark Salyzyn
77b5696b1d logd: liblog: logcat: switch to android_log_clockid()
android_log_timestamp returns the property leading letter,
it is better to return a clockid_t with android_log_clockid()

Bug: 23668800
Change-Id: I3c4e3e6b87f6676950797f1f0e203b44c542ed43
2015-12-04 14:49:19 -08:00
Mark Salyzyn
b6bee33182 liblog: logd: support logd.timestamp = monotonic
if ro.logd.timestamp or persist.logd.timestamp are set to the value
monotonic then liblog writer, liblog printing and logd all switch to
recording/printing monotonic time rather than realtime. If reinit
detects a change for presist.logd.timestamp, correct the older entry
timestamps in place.

ToDo: A corner case condition where new log entries in monotonic time
      occur before logd reinit detects persist.logd.timestamp, there
      will be a few out-of-order entries, but with accurate
      timestamps. This problem does not happen for ro.logd.timestamp
      as it is set before logd starts.

NB: This offers a nano second time accuracy on all log entries
    that may be more suitable for merging with other system
    activities, such as systrace, that also use monotonic time. This
    feature is for debugging.

Bug: 23668800
Change-Id: Iee6dab7140061b1a6627254921411f61b01aa5c2
2015-11-03 15:15:51 -08:00
Mark Salyzyn
9d4203aae1 Merge changes Iefbea3b1,Ieb924b6d
am: bb51fbc4d4

* commit 'bb51fbc4d4b311ae315e4d7dd174167ebeadc2a8':
  liblog: add android_log_timestamp() private function
  liblog: logcat: add epoch and monotonic format modifiers
2015-10-29 23:05:33 +00:00
Mark Salyzyn
4cbed02e44 liblog: logcat: add epoch and monotonic format modifiers
- '-v epoch' prints seconds since Jan 1 1970
- '-v monotonic' print cpu seconds since start of device
- '-T sssss.mmm...' as alternate tail time format

NB: monotonic is a best estimate and may be out by a few ms
    given the synchronization source clue accuracy.

Bug: 23668800
Change-Id: Ieb924b6d3817669c7e53beb9c970fb626eaad460
2015-10-29 14:23:42 -07:00
Bill Yi
27bdd9a71c Merge commit '2b88845e4d7ae862d9735eec3c03d633d4f1d58d' into HEAD 2015-10-08 10:37:51 -07:00
Mark Salyzyn
603b8e50c8 logcat: do not exit buffer loop on error
- Alter logcat to collect error(s) for open, clear, get size or set
  size; moving on to other buffer ids. Then after loop completed,
  report and exit for the last error reported.

Bug: 23711431
Change-Id: I63a729d27544ea8d5c6119625c1de0210be0eb70
2015-10-07 16:23:54 -07:00
Mark Salyzyn
07c50b02d7 am 58b136cb: Merge "logcat: continue where we left off"
* commit '58b136cbebe8526134ea9d7e89835b523f1cbe2e':
  logcat: continue where we left off
2015-10-07 14:36:30 +00:00
Mark Salyzyn
9812fc4bd0 logcat: continue where we left off
Issue introduced as part of new logcatd functionality in
commit f3555d9427

Faulty logic, add a gTest to confirm.

Bug: 19608716
Change-Id: Ic1b97def25e03e69faae4398a3dff2ff0f88545e
2015-10-06 12:46:54 -07:00
Mark Salyzyn
2ba96324a4 am 351c211c: am 447356dd: Merge "liblog: logcat: Add year and zone to date on each line"
* commit '351c211cc1bba3842c3e9d782888fdeec3adbd24':
  liblog: logcat: Add year and zone to date on each line
2015-09-30 20:11:42 +00:00
Mark Salyzyn
f28f6a9ba2 liblog: logcat: Add year and zone to date on each line
- '-v year' modifier adds the four digit year prefix
- '-v <timezone>' modifier sets and prints the timezone suffix
- Only promise in logcat to support UTC as a timezone since
  all others are based on the configured environment
- '-v zone' modifier toggles the timezone suffix on or off
- '-T YYYY-MM-DD HH:MM:SS.mmm...' format is added

Bug: 23668700
Change-Id: I7521c1efb7455dc9a25434fce72a69a65dcf72ea
2015-09-24 14:49:55 -07:00
Mark Salyzyn
3cbc7e7eaa am 6e78a2c5: am 6eec17e3: Merge "logcatd: up size from 16MB to 256MB"
* commit '6e78a2c5b6a052043b01ba36de21e7aec49c8735':
  logcatd: up size from 16MB to 256MB
2015-09-22 00:45:39 +00:00
Mark Salyzyn
44a34e4525 am 96f1b63a: am 44210dfe: Merge "logpersist: bundle with logcatd service"
* commit '96f1b63a916a86774780bc9e15ac857ac3dd6fde':
  logpersist: bundle with logcatd service
2015-09-21 22:31:59 +00:00
Tom Cherry
984bd8323d resolved conflicts for 5caca3dd to mnc-dr-dev-plus-aosp
Change-Id: I773e514a8232b77cdd566dc36c9efc4e15f206f0
2015-09-21 14:25:34 -07:00
Mark Salyzyn
3ffbdb9009 logcatd: up size from 16MB to 256MB
Change-Id: Ic151d42151efdb3103470ba46c626a800cf29125
2015-09-21 13:53:16 -07:00
Mark Salyzyn
8c943b6dc8 logpersist: bundle with logcatd service
Bug: 23186545
Change-Id: I130d7c7e120acb372e58aec028f39e161d53628e
2015-09-21 13:53:01 -07:00
Tom Cherry
20391b1de5 bundle init.rc contents with its service
Bug: 23186545
Change-Id: I52616b8ab1165fdef716f9b8f958665f2308c12e
2015-08-21 10:14:43 -07:00
Riley Andrews
aede9897df Lower the priority of the threads in logd/logcat.
(cherry pick from commit d98f4e8af5)

sched_batch implies only a penalty to latency in scheduling, but
does not imply that the process will be given less cpu time. Increase
the nice level to 10 to prioritize it below ui threads.

Bug: 21696721
Change-Id: I075af059dc755402f7df9b0d7a66cca921ff04b2
2015-06-09 12:40:20 -07:00
Riley Andrews
d98f4e8af5 Lower the priority of the threads in logd/logcat.
sched_batch implies only a penalty to latency in scheduling, but
does not imply that the process will be given less cpu time. Increase
the nice level to 10 to prioritize it below ui threads.

Bug: 21696721
Change-Id: I075af059dc755402f7df9b0d7a66cca921ff04b2
2015-06-09 12:36:45 -07:00
Mark Salyzyn
5d332907f0 liblog: logcat: Add printable format modifier
(cherry pick from commit b932b2f8ba)

- added printable format modifier:
  logcat -v printable
- opencoded borrowed individual utf8 validity checking algorithm
  from utf8_length() in libutils/Unicode.cpp
- if considered basic one-character ASCII, use popular \x escape
  sequences for non-printable
- logprint convert to C comments to drop mixed-mode

Bug: 19000361
Change-Id: I122a5b8fb41216fc0bc816178c0b768f3df56586
2015-06-04 08:37:14 -07:00
Mark Salyzyn
b932b2f8ba liblog: logcat: Add printable format modifier
- added printable format modifier:
  logcat -v printable
- opencoded borrowed individual utf8 validity checking algorithm
  from utf8_length() in libutils/Unicode.cpp
- if considered basic one-character ASCII, use popular \x escape
  sequences for non-printable
- logprint convert to C comments to drop mixed-mode

Bug: 19000361
Change-Id: I122a5b8fb41216fc0bc816178c0b768f3df56586
2015-06-04 08:27:29 -07:00
Mark Salyzyn
cdb468abb3 logcat: -f run in background
(cherry pick from commit 3ef730c57f)

- if saving to file, set SP_BACKGROUND policy
- if saving to file, set BATCH priority
- sort include files

Bug: 19608716
Change-Id: I00acb8b8db0d2ff9ff36c97f9e74604d31938376
2015-06-02 15:27:41 -07:00
Mark Salyzyn
117c322040 logcat: -f flag to continue
(cherry pick from commit f3555d9427)

On startup, check the current logging content, then grab logs from
that time forward rather than restarting from the beginning. Add
support for reading tail time down to the nano-second.

Bonus, permits us to create a logcatd logpersist daemon

Bug: 19608716
Change-Id: Iaab58de4c02b7f97c69de12cf954fedc2163059e
2015-06-02 15:26:53 -07:00
Mark Salyzyn
3ef730c57f logcat: -f run in background
- if saving to file, set SP_BACKGROUND policy
- if saving to file, set BATCH priority
- sort include files

Bug: 19608716
Change-Id: I00acb8b8db0d2ff9ff36c97f9e74604d31938376
2015-06-02 14:56:44 -07:00
Mark Salyzyn
f3555d9427 logcat: -f flag to continue
On startup, check the current logging content, then grab logs from
that time forward rather than restarting from the beginning. Add
support for reading tail time down to the nano-second.

Bonus, permits us to create a logcatd logpersist daemon

Bug: 19608716
Change-Id: Iaab58de4c02b7f97c69de12cf954fedc2163059e
2015-06-02 14:56:44 -07:00
Mark Salyzyn
79c3815ca1 logcat: liblog: Add "usec" format argument
(cherry pick from commit e1f2004ecc)

- Add additional 3 digits of time precision for time output
  adding in the reporting of usec
- Remove trailing space in header file

Change-Id: Ifb560850b8e01080e126fbaeab640db71cce3eea
2015-05-13 09:22:51 -07:00
Mark Salyzyn
e1f2004ecc logcat: liblog: Add "usec" format argument
- Add additional 3 digits of time precision for time output
  adding in the reporting of usec
- Remove trailing space in header file

Change-Id: Ifb560850b8e01080e126fbaeab640db71cce3eea
2015-05-12 15:51:46 -07:00
Jeff Brown
44193d9eae Add float support to binary event log.
Bug: 20664753
Change-Id: Ib4752bd785496dab5bb4d4979d5d80f662adbdfa
2015-04-28 18:20:48 -07:00
Jeff Brown
b1993b637f Add float support to binary event log.
Bug: 20664753
Change-Id: Ib4752bd785496dab5bb4d4979d5d80f662adbdfa
2015-04-28 17:52:37 -07:00
Mark Salyzyn
77d7e81c1c logcat: build regression
printflike checks for NULL fmt at compile time, checks for
NULL at runtime are optimized out. Regression as a result
of commit 5976303aa6.

Change-Id: Ia4e7ee4b6cb2adf1e6609c70e79684855f76e6fc
2015-04-13 09:27:57 -07:00
Traian Schiau
5976303aa6 logcat: Minor fixes
Remove -r default value implementation (since is not functional).
Check the status of some memory allocations.
Make sure that the pruning buffer is set to NULL if we get to the end of  the loop.
Make sure that the file status is successfully retrieved before using the size.
Add strtouia - string to unsigned argument.
Add logcat_panic with/without printing an error message and help.
Play nicer with the android namespace.

Change-Id: Id4c37cf64968128424e29bf1725f6c9a5924a0e2
Signed-off-by: Traian Schiau <traianx.schiau@intel.com>
2015-04-11 17:27:11 +03:00
Elliott Hughes
bcc2b5f44a Remove LOCAL_ADDITIONAL_DEPENDENCIES in cases where it's not needed.
Change-Id: I720b8ef1050da45a7833adef8219b6acb2cf3a38
2015-04-02 14:31:07 -07:00