From dcec26ac7badf0bb224773a4c09e4d9b70ca0e43 Mon Sep 17 00:00:00 2001 From: mehrdadn Date: Mon, 20 Jul 2020 11:03:58 -0700 Subject: [PATCH] Fix log losses (#9559) * Close log on shutdown * Disable log buffering Co-authored-by: Mehrdad --- src/ray/util/logging.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/ray/util/logging.cc b/src/ray/util/logging.cc index d9db5d34d..5b5b1eff1 100644 --- a/src/ray/util/logging.cc +++ b/src/ray/util/logging.cc @@ -200,6 +200,7 @@ void RayLog::StartRayLog(const std::string &app_name, RayLogLevel severity_thres strftime(buffer, sizeof(buffer), "%Y%m%d-%H%M%S", localtime(&rawtime)); std::string path = dir_ends_with_slash + app_name_without_path + "." + buffer + "." + std::to_string(pid) + ".log"; + stream_logger_singleton.out_.rdbuf()->pubsetbuf(0, 0); stream_logger_singleton.out_.open(path.c_str(), std::ios_base::app | std::ios_base::binary); } @@ -237,6 +238,7 @@ void RayLog::UninstallSignalAction() { } void RayLog::ShutDownRayLog() { + stream_logger_singleton.out_.close(); #ifdef RAY_USE_GLOG UninstallSignalAction(); google::ShutdownGoogleLogging();