android_system_core/logd
Tom Cherry 4ab009f0e7 logd: drop logs about pruning and compression to VERBOSE
These logs are not generally useful and can be considered to be spam
by some.  Drop them to VERBOSE so that we can be selectively enabled
when debugging logd.

Test: these logs do not appears by default.
Change-Id: Ic2bb12552d6f191478777c21f500794de29c8b0a
2020-09-28 13:05:32 -07:00
..
doc_images logd: document the decision to use compression instead of chatty 2020-08-10 11:53:51 -07:00
fuzz liblog: don't cache property size values and move to own file 2020-08-03 13:17:12 -07:00
.clang-format
Android.bp logd: enable CFI 2020-09-23 09:34:15 -07:00
AndroidTest.xml
ChattyLogBuffer.cpp logging: Use more inclusive language. 2020-06-16 14:31:31 -07:00
ChattyLogBuffer.h Fix logd's implicit dependency on libsysutils. 2020-08-20 15:40:57 -07:00
ChattyLogBufferTest.cpp
CommandListener.cpp logd: consolidate command handling and fix an error check 2020-08-07 09:48:16 -07:00
CommandListener.h Add android_logger_get_log_consumed_size() and report it in logcat 2020-08-05 13:43:31 -07:00
CompressionEngine.cpp logd: replace std::vector<uint8_t> in SerializedLogChunk 2020-06-24 16:19:28 -07:00
CompressionEngine.h logd: replace std::vector<uint8_t> in SerializedLogChunk 2020-06-24 16:19:28 -07:00
LogAudit.cpp logd: remove users of __android_logger_property_get_bool() 2020-07-28 13:16:11 -07:00
LogAudit.h
LogBuffer.h Query log size properties only within logd 2020-08-06 20:32:45 +00:00
LogBufferElement.cpp logd: optionally track the full size of log buffers 2020-07-01 14:35:33 -07:00
LogBufferElement.h logd: fix various clang-tidy issues 2020-06-17 11:40:55 -07:00
LogBufferTest.cpp liblog: don't cache property size values and move to own file 2020-08-03 13:17:12 -07:00
LogBufferTest.h Query log size properties only within logd 2020-08-06 20:32:45 +00:00
LogKlog.cpp Cleanup for #inclusivefixit. 2020-07-27 11:37:19 -07:00
LogKlog.h
LogListener.cpp
LogListener.h logd: fix various clang-tidy issues 2020-06-17 11:40:55 -07:00
LogPermissions.cpp logd: fix various clang-tidy issues 2020-06-17 11:40:55 -07:00
LogPermissions.h
LogReader.cpp logd: fix various clang-tidy issues 2020-06-17 11:40:55 -07:00
LogReader.h Fix logd's implicit dependency on libsysutils. 2020-08-20 15:40:57 -07:00
LogReaderList.cpp
LogReaderList.h
LogReaderThread.cpp logd: fix various clang-tidy issues 2020-06-17 11:40:55 -07:00
LogReaderThread.h Fix logd's implicit dependency on libsysutils. 2020-08-20 15:40:57 -07:00
LogSize.cpp Query log size properties only within logd 2020-08-06 20:32:45 +00:00
LogSize.h Query log size properties only within logd 2020-08-06 20:32:45 +00:00
LogStatistics.cpp logd: record and replay log messages 2020-07-17 15:08:21 -07:00
LogStatistics.h Add android_logger_get_log_consumed_size() and report it in logcat 2020-08-05 13:43:31 -07:00
LogTags.cpp Fix logd's implicit dependency on libsysutils. 2020-08-20 15:40:57 -07:00
LogTags.h
LogUtils.h Fix logd's implicit dependency on libsysutils. 2020-08-20 15:40:57 -07:00
LogWriter.h
OWNERS
PruneList.cpp logging: Use more inclusive language. 2020-06-16 14:31:31 -07:00
PruneList.h logging: Use more inclusive language. 2020-06-16 14:31:31 -07:00
README.auditd
README.compression.md logd: document the decision to use compression instead of chatty 2020-08-10 11:53:51 -07:00
README.property logd: remove users of __android_logger_property_get_bool() 2020-07-28 13:16:11 -07:00
README.replay.md logd: record and replay log messages 2020-07-17 15:08:21 -07:00
RecordedLogMessage.h logd: record and replay log messages 2020-07-17 15:08:21 -07:00
RecordingLogBuffer.cpp logd: record and replay log messages 2020-07-17 15:08:21 -07:00
RecordingLogBuffer.h logd: record and replay log messages 2020-07-17 15:08:21 -07:00
ReplayMessages.cpp Merge "liblog: don't cache property size values and move to own file" 2020-08-03 22:59:03 +00:00
SerializedData.h logd: replace std::vector<uint8_t> in SerializedLogChunk 2020-06-24 16:19:28 -07:00
SerializedFlushToState.cpp logd: additional logging if read_offset > buffer_it->write_offset() 2020-09-21 15:10:20 -07:00
SerializedFlushToState.h logd: remove min heap in SerializedFlushToState 2020-09-18 15:32:32 -07:00
SerializedFlushToStateTest.cpp logd: remove min heap in SerializedFlushToState 2020-09-18 15:32:32 -07:00
SerializedLogBuffer.cpp logd: drop logs about pruning and compression to VERBOSE 2020-09-28 13:05:32 -07:00
SerializedLogBuffer.h logd: SerializedLogBuffer: never wait for a reader during prune/clear 2020-08-12 12:49:56 -07:00
SerializedLogChunk.cpp logd: drop logs about pruning and compression to VERBOSE 2020-09-28 13:05:32 -07:00
SerializedLogChunk.h logd: remove min heap in SerializedFlushToState 2020-09-18 15:32:32 -07:00
SerializedLogChunkTest.cpp logd: Fix ClearUidLogs() when writer_active_ is true 2020-09-09 20:26:59 +00:00
SerializedLogEntry.h logd: optionally track the full size of log buffers 2020-07-01 14:35:33 -07:00
SimpleLogBuffer.cpp Query log size properties only within logd 2020-08-06 20:32:45 +00:00
SimpleLogBuffer.h Query log size properties only within logd 2020-08-06 20:32:45 +00:00
auditctl.cpp
event.logtags
libaudit.cpp
libaudit.h
logd.rc
logd_test.cpp Fix logd's implicit dependency on libsysutils. 2020-08-20 15:40:57 -07:00
logtagd.rc
main.cpp SocketClient: don't ignore SIGPIPE 2020-07-31 15:53:18 -07:00
rwlock.h logd: fix various clang-tidy issues 2020-06-17 11:40:55 -07:00

README.replay.md

logd can record and replay log messages for offline analysis.

Recording Messages

logd has a RecordingLogBuffer buffer that records messages to /data/misc/logd/recorded-messages. It stores messages in memory until that file is accessible, in order to capture all messages since the beginning of boot. It is only meant for logging developers to use and must be manually enabled in by adding RecordingLogBuffer.cpp to Android.bp and setting log_buffer = new SimpleLogBuffer(&reader_list, &log_tags, &log_statistics); in main.cpp.

Recording messages may delay the Log() function from completing and it is highly recommended to make the logd socket in liblog blocking, by removing SOCK_NONBLOCK from the socket() call in liblog/logd_writer.cpp.

Replaying Messages

Recorded messages can be replayed offline with the replay_messages tool. It runs on host and device and supports the following options:

  1. interesting - this prints 'interesting' statistics for each of the log buffer types (simple, chatty, serialized). The statistics are:
    1. Log Entry Count
    2. Size (the uncompressed size of the log messages in bytes)
    3. Overhead (the total cost of the log messages in memory in bytes)
    4. Range (the range of time that the logs cover in seconds)
  2. memory_usage BUFFER_TYPE - this prints the memory usage (sum of private dirty pages of the replay_messages process). Note that the input file is mmap()'ed as RO/Shared so it does not appear in these dirty pages, and a baseline is taken before allocating the log buffers, so only their contributions are measured. The tool outputs the memory usage every 100,000 messages.
  3. latency BUFFER_TYPE - this prints statistics of the latency of the Log() function for the given buffer type. It specifically prints the 1st, 2nd, and 3rd quartiles; the 95th, 99th, and 99.99th percentiles; and the maximum latency.
  4. print_logs BUFFER_TYPE [buffers] [print_point] - this prints the logs as processed by the given buffer_type from the buffers specified by buffers starting after the number of logs specified by print_point have been logged. This acts as if a user called logcat immediately after the specified logs have been logged, which is particularly useful since it will show the chatty pruning messages at that point. It additionally prints the statistics from logcat -S after the logs. buffers is a comma separated list of the numeric buffer id values from <android/log.h>. For example, 0,1,3 represents the main, radio, and system buffers. It can can also be all. print_point is an positive integer. If it is unspecified, logs are printed after the entire input file is consumed.
  5. nothing BUFFER_TYPE - this does nothing other than read the input file and call Log() for the given buffer type. This is used for profiling CPU usage of strictly the log buffer.