From 185bfc6cd259163733fa0342803de0b597ce0539 Mon Sep 17 00:00:00 2001 From: Aleks Lozovyuk Date: Sat, 16 Nov 2024 02:51:32 +0200 Subject: [PATCH] refactor: initialize google logger after parsing options (#2664) Co-authored-by: Twice --- src/cli/main.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/cli/main.cc b/src/cli/main.cc index 3eaf4b13b6b..2ce5f013aae 100644 --- a/src/cli/main.cc +++ b/src/cli/main.cc @@ -116,9 +116,6 @@ static void InitGoogleLog(const Config *config) { int main(int argc, char *argv[]) { srand(static_cast(util::GetTimeStamp())); - google::InitGoogleLogging("kvrocks"); - auto glog_exit = MakeScopeExit(google::ShutdownGoogleLogging); - evthread_use_pthreads(); auto event_exit = MakeScopeExit(libevent_global_shutdown); @@ -141,6 +138,8 @@ int main(int argc, char *argv[]) { crc64_init(); InitGoogleLog(&config); + google::InitGoogleLogging("kvrocks"); + auto glog_exit = MakeScopeExit(google::ShutdownGoogleLogging); LOG(INFO) << "kvrocks " << PrintVersion; // Tricky: We don't expect that different instances running on the same port, // but the server use REUSE_PORT to support the multi listeners. So we connect