diff --git a/src/ray/util/logging.cc b/src/ray/util/logging.cc index cb3b06f5c..63e82ec65 100644 --- a/src/ray/util/logging.cc +++ b/src/ray/util/logging.cc @@ -173,12 +173,12 @@ void RayLog::StartRayLog(const std::string &app_name, RayLogLevel severity_thres log_dir_ = log_dir; #ifdef RAY_USE_GLOG google::InitGoogleLogging(app_name_.c_str()); - // Enable log file if log_dir_ is not empty. - std::string dir_ends_with_slash = log_dir_; - if (!ray::IsDirSep(log_dir_[log_dir_.length() - 1])) { - dir_ends_with_slash += ray::GetDirSep(); - } if (!log_dir_.empty()) { + // Enable log file if log_dir_ is not empty. + std::string dir_ends_with_slash = log_dir_; + if (!ray::IsDirSep(log_dir_[log_dir_.length() - 1])) { + dir_ends_with_slash += ray::GetDirSep(); + } std::string app_name_without_path = app_name; if (app_name.empty()) { app_name_without_path = "DefaultApp";