summaryrefslogtreecommitdiff
path: root/sideload_main.cc
diff options
context:
space:
mode:
authorYifan Hong <elsk@google.com>2020-04-06 15:08:24 -0700
committerYifan Hong <elsk@google.com>2020-04-08 11:16:49 -0700
commita73445f65eb8b639a279ceb58a067b916f59a1e9 (patch)
tree9b63b260320f96fb7d513ffe747c41ee53613bed /sideload_main.cc
parent38093bbb34a6af672541a79fe16a16c888fafd0c (diff)
sideload: fix duplicated logging
Also align logging behavior in sideload and regular Android. - Use logging_android.cc as well - Add a logging handler to libchrome's logging so that it won't explicitly write to stderr after calling __android_log_write. Test: sideload and manually inspect /tmp/recovery.log Fixes: 153355820 Change-Id: Iffaf245e8dec598ae8fd82052e2183a35afd604e (cherry picked from commit e757420cd6042fb68d9a3630a0d00e795c3f2ffe) Merged-In: Iffaf245e8dec598ae8fd82052e2183a35afd604e
Diffstat (limited to 'sideload_main.cc')
-rw-r--r--sideload_main.cc15
1 files changed, 2 insertions, 13 deletions
diff --git a/sideload_main.cc b/sideload_main.cc
index 818fa5c9..27967cda 100644
--- a/sideload_main.cc
+++ b/sideload_main.cc
@@ -20,7 +20,6 @@
#include <vector>
#include <base/command_line.h>
-#include <base/logging.h>
#include <base/strings/string_split.h>
#include <base/strings/stringprintf.h>
#include <brillo/asynchronous_signal_handler.h>
@@ -36,6 +35,7 @@
#include "update_engine/common/subprocess.h"
#include "update_engine/common/terminator.h"
#include "update_engine/common/utils.h"
+#include "update_engine/logging.h"
#include "update_engine/update_attempter_android.h"
using std::string;
@@ -46,17 +46,6 @@ using update_engine::UpdateStatus;
namespace chromeos_update_engine {
namespace {
-void SetupLogging() {
- string log_file;
- logging::LoggingSettings log_settings;
- log_settings.lock_log = logging::DONT_LOCK_LOG_FILE;
- log_settings.delete_old = logging::APPEND_TO_OLD_LOG_FILE;
- log_settings.log_file = nullptr;
- log_settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG;
-
- logging::InitLogging(log_settings);
-}
-
class SideloadDaemonState : public DaemonStateInterface,
public ServiceObserverInterface {
public:
@@ -195,7 +184,7 @@ int main(int argc, char** argv) {
DEFINE_int64(status_fd, -1, "A file descriptor to notify the update status.");
chromeos_update_engine::Terminator::Init();
- chromeos_update_engine::SetupLogging();
+ chromeos_update_engine::SetupLogging(true /* stderr */, false /* file */);
brillo::FlagHelper::Init(argc, argv, "Update Engine Sideload");
LOG(INFO) << "Update Engine Sideloading starting";