Fix log losses (#9559)

* Close log on shutdown

* Disable log buffering

Co-authored-by: Mehrdad <noreply@github.com>
This commit is contained in:
mehrdadn
2020-07-20 11:03:58 -07:00
committed by GitHub
parent fca1fb18f3
commit dcec26ac7b
+2
View File
@@ -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();