From ba2a649c0009ce0c2746a2513460f3b9f34e7738 Mon Sep 17 00:00:00 2001 From: Kongqun Yang Date: Wed, 31 Aug 2016 14:50:19 -0700 Subject: [PATCH] LOG_TO_SYSTEM_DEBUG_LOG instead of a file The current behavior of logging to a file in the same directory as the binary will break if the binary does not have write access to that directory. Fixes Issue #139 Change-Id: I11adfaec676fc9bbef2a5caa3261889d1fba3b88 --- packager/app/mpd_generator.cc | 6 +++++- packager/app/packager_main.cc | 7 +------ packager/media/test/run_tests_with_atexit_manager.cc | 7 +------ 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/packager/app/mpd_generator.cc b/packager/app/mpd_generator.cc index 322b838f14..0f076d3ff0 100644 --- a/packager/app/mpd_generator.cc +++ b/packager/app/mpd_generator.cc @@ -91,7 +91,11 @@ int MpdMain(int argc, char** argv) { base::AtExitManager exit; // Needed to enable VLOG/DVLOG through --vmodule or --v. base::CommandLine::Init(argc, argv); - CHECK(logging::InitLogging(logging::LoggingSettings())); + + // Set up logging. + logging::LoggingSettings log_settings; + log_settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; + CHECK(logging::InitLogging(log_settings)); google::SetUsageMessage(base::StringPrintf(kUsage, argv[0])); google::ParseCommandLineFlags(&argc, &argv, true); diff --git a/packager/app/packager_main.cc b/packager/app/packager_main.cc index 3a1e04020b..f2cd87e865 100644 --- a/packager/app/packager_main.cc +++ b/packager/app/packager_main.cc @@ -531,12 +531,7 @@ int PackagerMain(int argc, char** argv) { // Set up logging. logging::LoggingSettings log_settings; - base::FilePath log_filename; - PathService::Get(base::DIR_EXE, &log_filename); - log_filename = log_filename.AppendASCII("packager.log"); - log_settings.logging_dest = logging::LOG_TO_ALL; - log_settings.log_file = log_filename.value().c_str(); - log_settings.delete_old = logging::DELETE_OLD_LOG_FILE; + log_settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; CHECK(logging::InitLogging(log_settings)); google::SetUsageMessage(base::StringPrintf(kUsage, argv[0])); diff --git a/packager/media/test/run_tests_with_atexit_manager.cc b/packager/media/test/run_tests_with_atexit_manager.cc index 49d4424695..57db4eb583 100644 --- a/packager/media/test/run_tests_with_atexit_manager.cc +++ b/packager/media/test/run_tests_with_atexit_manager.cc @@ -20,12 +20,7 @@ int main(int argc, char **argv) { // Set up logging. logging::LoggingSettings log_settings; - base::FilePath log_filename; - PathService::Get(base::DIR_EXE, &log_filename); - log_filename = log_filename.AppendASCII("test.log"); - log_settings.logging_dest = logging::LOG_TO_ALL; - log_settings.log_file = log_filename.value().c_str(); - log_settings.delete_old = logging::DELETE_OLD_LOG_FILE; + log_settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; CHECK(logging::InitLogging(log_settings)); ::testing::InitGoogleTest(&argc, argv);