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
This commit is contained in:
parent
7cbc2720dc
commit
ba2a649c00
|
@ -91,7 +91,11 @@ int MpdMain(int argc, char** argv) {
|
||||||
base::AtExitManager exit;
|
base::AtExitManager exit;
|
||||||
// Needed to enable VLOG/DVLOG through --vmodule or --v.
|
// Needed to enable VLOG/DVLOG through --vmodule or --v.
|
||||||
base::CommandLine::Init(argc, argv);
|
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::SetUsageMessage(base::StringPrintf(kUsage, argv[0]));
|
||||||
google::ParseCommandLineFlags(&argc, &argv, true);
|
google::ParseCommandLineFlags(&argc, &argv, true);
|
||||||
|
|
|
@ -531,12 +531,7 @@ int PackagerMain(int argc, char** argv) {
|
||||||
|
|
||||||
// Set up logging.
|
// Set up logging.
|
||||||
logging::LoggingSettings log_settings;
|
logging::LoggingSettings log_settings;
|
||||||
base::FilePath log_filename;
|
log_settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG;
|
||||||
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;
|
|
||||||
CHECK(logging::InitLogging(log_settings));
|
CHECK(logging::InitLogging(log_settings));
|
||||||
|
|
||||||
google::SetUsageMessage(base::StringPrintf(kUsage, argv[0]));
|
google::SetUsageMessage(base::StringPrintf(kUsage, argv[0]));
|
||||||
|
|
|
@ -20,12 +20,7 @@ int main(int argc, char **argv) {
|
||||||
|
|
||||||
// Set up logging.
|
// Set up logging.
|
||||||
logging::LoggingSettings log_settings;
|
logging::LoggingSettings log_settings;
|
||||||
base::FilePath log_filename;
|
log_settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG;
|
||||||
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;
|
|
||||||
CHECK(logging::InitLogging(log_settings));
|
CHECK(logging::InitLogging(log_settings));
|
||||||
|
|
||||||
::testing::InitGoogleTest(&argc, argv);
|
::testing::InitGoogleTest(&argc, argv);
|
||||||
|
|
Loading…
Reference in New Issue