From 3d0d9c35f6960807cba0abacf25ef2efd04fe839 Mon Sep 17 00:00:00 2001 From: Kelvin Zhang Date: Wed, 20 Apr 2022 14:51:30 -0700 Subject: [PATCH] Log a copy of recovery log to kernel logs Currently, recovery logs are only saved to /tmp/recovery.log . That's bad, because /tmp/recovery.log would not be available after reboot. To help debugging recovery issues, log a copy to kernel log, which will be saved in pstore after device reboots. Bug: 228893064 Change-Id: I0f97b402726ecabe644f3ff5182f71bd16d0b111 --- recovery_main.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/recovery_main.cpp b/recovery_main.cpp index 80cba61d..9a358aba 100644 --- a/recovery_main.cpp +++ b/recovery_main.cpp @@ -73,12 +73,12 @@ static bool IsDeviceUnlocked() { return "orange" == android::base::GetProperty("ro.boot.verifiedbootstate", ""); } -static void UiLogger(android::base::LogId /* id */, android::base::LogSeverity severity, - const char* /* tag */, const char* /* file */, unsigned int /* line */, - const char* message) { - static constexpr char log_characters[] = "VDIWEF"; +static void UiLogger(android::base::LogId log_buffer_id, android::base::LogSeverity severity, + const char* tag, const char* file, unsigned int line, const char* message) { + android::base::KernelLogger(log_buffer_id, severity, tag, file, line, message); + static constexpr auto&& log_characters = "VDIWEF"; if (severity >= android::base::ERROR && ui != nullptr) { - ui->Print("E:%s\n", message); + ui->Print("ERROR: %10s: %s\n", tag, message); } else { fprintf(stdout, "%c:%s\n", log_characters[severity], message); }