Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create default log under log dir #4766

Merged
merged 5 commits into from
Apr 29, 2021
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
/examples/**/oneflow
/benchmark/**/oneflow
log/
default_physical_env_log/
*plan
core.*
*.pyc
Expand Down
1 change: 0 additions & 1 deletion oneflow/core/job/env.proto
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ message CppLoggingConf {
optional string log_dir = 1 [default = "./log"];
optional int32 logtostderr = 2 [default = 0];
optional int32 logbuflevel = 3 [default = -1];
optional string default_physical_env_log_dir = 4 [default = "./default_physical_env_log"];
}

message EnvProto {
Expand Down
5 changes: 3 additions & 2 deletions oneflow/core/job/env_global_objects_scope.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,16 @@ namespace {
std::string LogDir(const std::string& log_dir) {
char hostname[255];
CHECK_EQ(gethostname(hostname, sizeof(hostname)), 0);
std::string v = log_dir + "/" + std::string(hostname);
std::string v = JoinPath(log_dir, std::string(hostname));
return v;
}

void InitLogging(const CppLoggingConf& logging_conf, bool default_physical_env) {
if (!default_physical_env) {
FLAGS_log_dir = LogDir(logging_conf.log_dir());
} else {
FLAGS_log_dir = LogDir(logging_conf.default_physical_env_log_dir());
std::string default_env_log_path = JoinPath(logging_conf.log_dir(), "default_physical_env_log");
FLAGS_log_dir = LogDir(default_env_log_path);
}
FLAGS_logtostderr = logging_conf.logtostderr();
FLAGS_logbuflevel = logging_conf.logbuflevel();
Expand Down