Skip to content

Commit

Permalink
fix_startup_service_failed_when_log_directory_not_exists_and_enable_b…
Browse files Browse the repository at this point in the history
…reakPad
  • Loading branch information
panda-sheep committed Sep 6, 2022
1 parent bcab2f3 commit bf024e4
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 20 deletions.
20 changes: 10 additions & 10 deletions src/daemons/MetaDaemon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,6 @@ int main(int argc, char* argv[]) {

Status status;

#if defined(ENABLE_BREAKPAD)
status = setupBreakpad();
if (!status.ok()) {
LOG(ERROR) << status;
return EXIT_FAILURE;
}
#endif

auto pidPath = FLAGS_pid_file;
status = ProcessUtils::isPidAvailable(pidPath);
if (!status.ok()) {
Expand All @@ -92,18 +84,26 @@ int main(int argc, char* argv[]) {
return EXIT_FAILURE;
}

// Setup logging
status = setupLogging(argv[0]);
if (!status.ok()) {
LOG(ERROR) << status;
return EXIT_FAILURE;
}

if (FLAGS_daemonize) {
google::SetStderrLogging(google::FATAL);
} else {
google::SetStderrLogging(google::INFO);
}

// Setup logging
status = setupLogging(argv[0]);
#if defined(ENABLE_BREAKPAD)
status = setupBreakpad();
if (!status.ok()) {
LOG(ERROR) << status;
return EXIT_FAILURE;
}
#endif

// Init stats
nebula::initMetaStats();
Expand Down
21 changes: 11 additions & 10 deletions src/daemons/StorageDaemon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,6 @@ int main(int argc, char *argv[]) {

Status status;

#if defined(ENABLE_BREAKPAD)
status = setupBreakpad();
if (!status.ok()) {
LOG(ERROR) << status;
return EXIT_FAILURE;
}
#endif

auto pidPath = FLAGS_pid_file;
status = ProcessUtils::isPidAvailable(pidPath);
if (!status.ok()) {
Expand All @@ -80,18 +72,27 @@ int main(int argc, char *argv[]) {
if (FLAGS_enable_ssl || FLAGS_enable_meta_ssl) {
folly::ssl::init();
}

// Setup logging
status = setupLogging(argv[0]);
if (!status.ok()) {
LOG(ERROR) << status;
return EXIT_FAILURE;
}

if (FLAGS_daemonize) {
google::SetStderrLogging(google::FATAL);
} else {
google::SetStderrLogging(google::INFO);
}

// Setup logging
status = setupLogging(argv[0]);
#if defined(ENABLE_BREAKPAD)
status = setupBreakpad();
if (!status.ok()) {
LOG(ERROR) << status;
return EXIT_FAILURE;
}
#endif

// Init stats
nebula::initStorageStats();
Expand Down

0 comments on commit bf024e4

Please sign in to comment.