Fix early init logging.
Remove the /dev/__kmsg__ workarounds (which can then be removed
from sepolicy), and fix confusion in the translation between
android-base logging and kernel logging priorities (in particular,
where 'notice' comes in the hierarchy).
Bug: http://b/30317429
Change-Id: I6eaf9919904b6b55bc402c20bf1a4ae269014bc7
Test: adb shell dmesg | grep init
diff --git a/init/log.cpp b/init/log.cpp
index 3934ca0..379141a 100644
--- a/init/log.cpp
+++ b/init/log.cpp
@@ -26,8 +26,12 @@
#include <selinux/selinux.h>
static const int kLogSeverityToKLogLevel[] = {
- KLOG_NOTICE_LEVEL, KLOG_DEBUG_LEVEL, KLOG_INFO_LEVEL,
- KLOG_WARNING_LEVEL, KLOG_ERROR_LEVEL, KLOG_ERROR_LEVEL,
+ [android::base::VERBOSE] = KLOG_DEBUG_LEVEL,
+ [android::base::DEBUG] = KLOG_DEBUG_LEVEL,
+ [android::base::INFO] = KLOG_INFO_LEVEL,
+ [android::base::WARNING] = KLOG_WARNING_LEVEL,
+ [android::base::ERROR] = KLOG_ERROR_LEVEL,
+ [android::base::FATAL] = KLOG_ERROR_LEVEL,
};
static_assert(arraysize(kLogSeverityToKLogLevel) == android::base::FATAL + 1,
"Mismatch in size of kLogSeverityToKLogLevel and values in LogSeverity");
@@ -68,7 +72,7 @@
if (fd > 2) close(fd);
android::base::InitLogging(argv, &KernelLogger);
- klog_set_level(KLOG_NOTICE_LEVEL);
+ klog_set_level(KLOG_INFO_LEVEL);
}
int selinux_klog_callback(int type, const char *fmt, ...) {