Skip to content
Snippets Groups Projects
Unverified Commit eb064421 authored by panda-sheep's avatar panda-sheep Committed by GitHub
Browse files

Generate log directory if not exist (#873)


Co-authored-by: default avatarYee <2520865+yixinglu@users.noreply.github.com>
parent 3c66147b
No related branches found
No related tags found
No related merge requests found
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
--enable_optimizer=true --enable_optimizer=true
########## logging ########## ########## logging ##########
# The directory to host logging files, which must already exists # The directory to host logging files
--log_dir=logs --log_dir=logs
# Log level, 0, 1, 2, 3 for INFO, WARNING, ERROR, FATAL respectively # Log level, 0, 1, 2, 3 for INFO, WARNING, ERROR, FATAL respectively
--minloglevel=0 --minloglevel=0
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
--enable_optimizer=true --enable_optimizer=true
########## logging ########## ########## logging ##########
# The directory to host logging files, which must already exists # The directory to host logging files
--log_dir=logs --log_dir=logs
# Log level, 0, 1, 2, 3 for INFO, WARNING, ERROR, FATAL respectively # Log level, 0, 1, 2, 3 for INFO, WARNING, ERROR, FATAL respectively
--minloglevel=0 --minloglevel=0
......
...@@ -25,6 +25,7 @@ using nebula::Status; ...@@ -25,6 +25,7 @@ using nebula::Status;
using nebula::ProcessUtils; using nebula::ProcessUtils;
using nebula::graph::GraphService; using nebula::graph::GraphService;
using nebula::network::NetworkUtils; using nebula::network::NetworkUtils;
using nebula::fs::FileUtils;
static std::unique_ptr<apache::thrift::ThriftServer> gServer; static std::unique_ptr<apache::thrift::ThriftServer> gServer;
...@@ -197,6 +198,14 @@ void signalHandler(int sig) { ...@@ -197,6 +198,14 @@ void signalHandler(int sig) {
Status setupLogging() { Status setupLogging() {
// If the log directory does not exist, try to create
if (!FileUtils::exist(FLAGS_log_dir)) {
if (!FileUtils::makeDir(FLAGS_log_dir)) {
return Status::Error("Failed to create log directory `%s'",
FLAGS_log_dir.c_str());
}
}
if (!FLAGS_redirect_stdout) { if (!FLAGS_redirect_stdout) {
return Status::OK(); return Status::OK();
} }
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment