History log of /system/core/liblog/logger_write.c
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
81321a7980903fbdb42f6bd838445c651fd7996e 09-Mar-2017 Mark Salyzyn <salyzyn@google.com> liblog: replace "frontend" with "transport"

We still do not have any users of the 'frontend' interface, let's
right a wrong and rename it to 'transport' as it makes more sense.
Renames android_log_set_frontend, android_log_get_frontend and
include/log/log_frontend.h.

SideEffects: None
Test: gTest liblog-unit-tests
Bug: 27405083
Change-Id: I7c1c0f3dfdc7cf047285403e306edbd16ad1324d
/system/core/liblog/logger_write.c
2ed51d708eda64516ec79ac6397f690de38f0075 09-Mar-2017 Mark Salyzyn <salyzyn@google.com> liblog: specify clang format

Switch coding style to match

SideEffects: None
Test: compile
Bug: 27405083
Change-Id: Id426d5c5e3b18f2ceec22b31bbc9781aabf6bcca
/system/core/liblog/logger_write.c
4d99c986d9310eb5fbc29618487577d645788eec 28-Feb-2017 Mark Salyzyn <salyzyn@google.com> liblog: add LOGGER_STDERR frontend

Standalone, this logger provides no end-to-end capability. Only
provides a writer, no reader transport. All output goes, logcat-like,
into the stderr stream. Output can be adjusted with environment
variables ANDROID_PRINTF_LOG and ANDROID_LOG_TAGS.

liblog_*.__android_log_bswrite_and_print___max print fails if a string
member is truncated with "Binary log entry conversion failed" and -1.
We expose the truncated content in the tests and in LOGGER_STDERR.

The purpose of this transport selection is for command-line tools,
providing a means to shunt the logs to be mixed in with the tool's
error stream.

Test: gTest liblog-unit-tests
Bug: 27405083
Change-Id: If344b6e3e67df2dc86ce317cfad8af8e857727b7
/system/core/liblog/logger_write.c
71002885325be3a0c4a0d09a6a6ad9b14531bdd7 09-Mar-2016 Mark Salyzyn <salyzyn@google.com> liblog: add local_logger

- Create the local-only logger module
- Add LOGGER_LOCAL flag to android_set_log_frontend to enable
- Permit log reader for host compilation

android_set_log_frontend(LOGGER_LOCAL) will result in logs going
into application local memory. logcat can not retrieve the data,
the user must utilize the log reading interface directly to
acquire their own logs. Some local logger tests dropped as they
represent testing other liblog facilities. Other local logger
tests dropped because we make the conscious decision to not
support LOG_ID_SECURITY logging.

ToDo: Some local logger tests dropped because of missing
functionality associated with blocking reader.

Test: gTest libcutils-tests, logd-unit-tests, liblog-unit-tests,
logcat-unit-tests, liblog-benchmarks and CtsLiblogTestCases_list
Bug: 27405083
Change-Id: Ia23b932af9e05756eaa60bab9139876b14faf72d
/system/core/liblog/logger_write.c
850d06e1c94bd292841c3ed9d7e1c0161d84d743 04-Feb-2015 Mark Salyzyn <salyzyn@google.com> liblog: Add android_set_log_frontend

android_set_log_frontend allows one to select LOGGER_DEFAULT,
LOGGER_LOGD or LOGGER_NULL, the latter allows a runtime mechanism to
turn logging on or off. LOGGER_DEFAULT is LOGGER_LOGD.

Test: gTest liblog-unit-tests notably liblog.android_set_log_frontend
and liblog-benchmarks before and after.
Bug: 27405083
Change-Id: I365dbee9f7d83112da0ef8d1cace748d247773c8
/system/core/liblog/logger_write.c
6efb877973fd66ad905d423bebe062bf7dd7c6ba 08-Feb-2017 Ting-Yuan Huang <laszio@google.com> liblog: fix an undefined-behavor in __write_to_log_daemon()

The behavior of passing NULL to c-string functions is undefined.

Test: passed clang-tidy checks
Bug: none

Change-Id: Ie7bcc43cd19bc4a1c314381af3929eae0a6154b9
/system/core/liblog/logger_write.c
5bae1b866d309f3d59aaab8e9a007413b3c68f83 06-Feb-2017 Elliott Hughes <enh@google.com> Make __android_log_assert behave more like libc asserts.

If we don't output to stderr too, not only is it annoying to shell users (who
won't see anything), it prevents us from writing better gtests that actually
make assertions about the assert message.

Bug: http://b/23675822
Test: libutils tests still pass
Change-Id: I62b3144c385cba4dde485f0b0f9b42aeaef51e9a
/system/core/liblog/logger_write.c
142b43d4ab47f8f98748a9d560934a1f8f90c898 28-Dec-2016 Mark Salyzyn <salyzyn@google.com> liblog: BM_log_latency improvement

This reduces BM_log_latency from ~300ns to ~100ns. Because, well, we
read the clock earlier and that is what BM_log_latency tries to
measure. The one major improvement in the switch from kernel logger
to user space logger was that we picked up the timestamp in the
context of the caller before doing anything else, but alas changes
over time neglected this fact and placed isloggable checking ahead
of this important fact.

Test: liblog_benchmarks, check results
Change-Id: I4bc9fc3cf8b1659e88417d967b1d0f3743f9e456
/system/core/liblog/logger_write.c
1abc3cd641120aceabde7dd927f6dfc5b565e242 30-Nov-2016 Treehugger Robot <treehugger-gerrit@google.com> Merge changes Ia0ca36fc,Ib42c0635

* changes:
Enable liblog on host bionic
Enable libbase/libutils/libziparchive on host bionic
0910d2dbb924fd70911e89526ad936282c54a650 29-Nov-2016 Dan Willemsen <dwillemsen@google.com> Enable liblog on host bionic

Some of the __BIONIC__ checks were actually looking for an android
device. Host bionic has __BIONIC__, but not __ANDROID__.

Bug: 31559095
Test: Test linux_bionic compile
Change-Id: Ia0ca36fc9486fe8ea7e5d1b2e26ab0491903723c
/system/core/liblog/logger_write.c
1179eb8048f5861bf92b29441230381526d30e5d 11-Nov-2016 Mark Salyzyn <salyzyn@google.com> system/core: replace EVENT_TAG_MAP_FILE with NULL

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
/system/core/liblog/logger_write.c
53e9fc791548ee0f81d6e749304359c0c335952d 09-Nov-2016 Mark Salyzyn <salyzyn@google.com> liblog: android_closeEventTagMap pointer check

Followup to c/278768 where failure to open tag map can
result in segment violation in android_closeEventTagMap.
Add check for pointer value = -1 to bypass call to close.

Test: gTest liblog-unit-tests, logcat-unit-tests & logd-unit-tests
Bug: 30963384
Bug: 31456426
Change-Id: I20547e55d7e29682fde4538bc1fc6d83b4535d49
/system/core/liblog/logger_write.c
cfd5b080af8de527d768f0ff7902c26af8d49307 17-Oct-2016 Mark Salyzyn <salyzyn@google.com> system/core: preparation to pull back interfaces from android/log.h

Point to log/log.h where necessary, define LOG_TAG where necessary.
Accept that private/android_logger.h is suitable replacement for
log/logger.h and android/log.h.

Correct liblog/README

Effectively a cleanup and controlled select revert of
'system/core: drop or replace log/logger.h' and
'system/core: Replace log/log.h with android/log.h'.

Test: compile
Bug: 30465923
Change-Id: Ic2ad157bad6f5efe2c6af293a73bb753300b17a2
/system/core/liblog/logger_write.c
807e40ecc9786755e2f74a7a6a9b20c812588119 22-Sep-2016 Mark Salyzyn <salyzyn@google.com> liblog: logd: Add android_lookupEventTag_len()

Allows us to mitigate the impact of MAP_PRIVATE and copy on write by
calling android_lookupEventTag_len instead of android_lookupEventTag,
and delaying the copy on write impact to the later. We return a
string length in a supplied location along with the string pointer
with android_lookupEventTag_len(const EventTagMap* map, size_t* len,
int tag). The string is not guaranteed to be nul terminated. Since
android_lookupEventTag() called even once can cause the memory
impact, we will mark it as deprecated, but we currently have no
timeframe for removal since this is a very old interface.

Add an API for __android_log_is_loggable_len() that accepts the non
null terminated content and fixup callers that would gain because the
length is known prior to the call either in the compiler or at
runtime. Tackle transition to android_lookupEventTag_len() and
fixup callers.

On any application that performs logging (eg: com.android.phone)

/proc/<pid>/smaps before:

xxxxxxxxxx-xxxxxxxxxx rw-p 00000000 fd:00 463 /system/etc/event-log-tags
Size: 20 kB
Rss: 20 kB
Pss: 1 kB
Shared_Clean: 0 kB
Shared_Dirty: 20 kB
Private_Clean: 0 kB
Private_Dirty: 0 kB
Referenced: 0 kB
Anonymous: 20 kB
AnonHugePages: 0 kB
Swap: 0 kB
SwapPss: 0 kB
KernelPageSize: 4 kB
MMUPageSize: 4 kB
Locked: 0 kB
VmFlags: rd wr mr mw me ac

/proc/<pid>/smaps after:

xxxxxxxxxx-xxxxxxxxxx rw-p 00000000 fd:00 1773 /system/etc/event-log-tags
Size: 20 kB
Rss: 20 kB
Pss: 1 kB
Shared_Clean: 20 kB (was 0kB)
Shared_Dirty: 0 kB (was 20kB)
Private_Clean: 0 kB
Private_Dirty: 0 kB
Referenced: 20 kB (was 0kB)
Anonymous: 0 kB (was 20kB)
AnonHugePages: 0 kB
Swap: 0 kB
SwapPss: 0 kB
KernelPageSize: 4 kB
MMUPageSize: 4 kB
Locked: 0 kB
VmFlags: rd wr mr mw me ac

Added liblog-unit-tests --gtest_filter=liblog.event_log_tags to
check for Shared_Clean: to not be 0 and Anonymous: to be 0 for
all processes referencing event-log-tags. Which can include multiple
references to /system/etc/event-log-tags and future possible refs to
/data/misc/logd/event-log-tags and /dev/event-log-tags. We want
failure messages to help point to errant code using the deprecated
interface.

This change saves 1/4MB of memory or more on a typical system.

Test: gTest liblog-unit-tests
Bug: 31456426
Change-Id: I9e08e44d9092bd96fe704b5709242e7195281d33
/system/core/liblog/logger_write.c
6584d0a35ab7722bdc6590525dee29f72f0ec576 28-Sep-2016 Mark Salyzyn <salyzyn@google.com> liblog: Replace log/log.h with android/log.h

Move all liblog related content into android/log.h, and make
log/log.h points to android/log.h.

Test: Compile
Bug: 26552300
Bug: 31289077
Change-Id: I858e0ebe047b86f2a8530a99bc9c380d3d58edbb
/system/core/liblog/logger_write.c
a166708d1541007ab5502040051e31863a29edce 28-Sep-2016 Mark Salyzyn <salyzyn@google.com> liblog: logcat: Replace log/logd.h with log/log.h

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
/system/core/liblog/logger_write.c
004cd3c55def10a92888295a9bad5fd0a18b725e 28-Sep-2016 Mark Salyzyn <salyzyn@google.com> liblog: logd: logcat: deprecate log/log_read.h

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
/system/core/liblog/logger_write.c
ba1a798fd8073b6069165cc03289fb9399f0495b 13-Sep-2016 Mark Salyzyn <salyzyn@google.com> liblog: free event tag map in __android_log_close()

There is no leak since a reference always remained and could get
reused. It just makes sense to also close the event tag map as well
if logging is closed. If we close we also have to fix a tagArray
leak in android_closeEventTagMap().

NB: __android_log_close() already makes an assumption that another
thread is not logging at the same time, which is true in all callers
at this time. There are some partial mitigation strategies if
__android_log_close() is called asynchronously, but not completely
solved at the cost of a lock for every logging call.

Test: gTest liblog-unit-tests
Bug: 30963384
Bug: 31456426
Change-Id: Ib76ad9302dba4d3f35250213f4dfef22498af238
/system/core/liblog/logger_write.c
df7a4c6bae5f85532d79a93b7d9197a2aab17825 23-Aug-2016 Mark Salyzyn <salyzyn@google.com> liblog: add __android_log_close()

Bug: 30963384
Change-Id: I901e6ac2cc3c601bbecc2d64e00a98e2ab448210
/system/core/liblog/logger_write.c
c33103c440517ae8fa5589c22eef795627adf793 29-Mar-2016 Mark Salyzyn <salyzyn@google.com> liblog: gate write on log id available

- Secure LOG_ID_KERNEL in writer
- Secure LOG_ID_SECURITY in reader and writer
- if writer transport says not available, do not write to that log id

Bug: 27566046
Bug: 27896341
Change-Id: If63a78a56fb94adfbf9979454c4cadb81af45c19
/system/core/liblog/logger_write.c
018a96d03f0d452bf078084eedcd5693da42308d 01-Mar-2016 Mark Salyzyn <salyzyn@google.com> liblog: split out transports into separate files

Create config_logger, logger and logger_read to house the log
interfaces. Add fake_logger, logd_logger and pmsg_logger to
house the write and read transports. Allows for an easier and
direct path to add new transports to the library.

SideEffects: None, logger benchmark performance unaffected

Bug: 27176738
Bug: 27405083
Change-Id: I01b38637334a5242905c8c89f6ab0a92e2540008
/system/core/liblog/logger_write.c