From 104cda1a767d7c0de5e9195c2bd1314d72c2e58f Mon Sep 17 00:00:00 2001 From: Wang XiangYu Date: Fri, 8 May 2020 16:57:08 +0800 Subject: [PATCH] print warning on stdout (#2243) * print warning on stdout Signed-off-by: wxyu * update Signed-off-by: wxyu * fix compile failed Signed-off-by: wxyu --- core/src/server/Server.cpp | 53 ++++++++++++-------------------------- 1 file changed, 17 insertions(+), 36 deletions(-) diff --git a/core/src/server/Server.cpp b/core/src/server/Server.cpp index 22bfdb3f67..6e97cadde4 100644 --- a/core/src/server/Server.cpp +++ b/core/src/server/Server.cpp @@ -159,6 +159,14 @@ Server::Start() { Config& config = Config::GetInstance(); + std::string meta_uri; + CONFIG_CHECK(config.GetDBConfigBackendUrl(meta_uri)); + if (meta_uri.length() > 6 && strcasecmp("sqlite", meta_uri.substr(0, 6).c_str()) == 0) { + std::cout << "WARNNING: You are using SQLite as the meta data management, " + "which can't be used in production. Please change it to MySQL!" + << std::endl; + } + /* Init opentracing tracer from config */ std::string tracing_config_path; s = config.GetTracingConfigJsonConfigPath(tracing_config_path); @@ -201,42 +209,15 @@ Server::Start() { std::string logs_path; int64_t max_log_file_size = 0; int64_t delete_exceeds = 0; - s = config.GetLogsTraceEnable(trace_enable); - if (!s.ok()) { - return s; - } - s = config.GetLogsDebugEnable(debug_enable); - if (!s.ok()) { - return s; - } - s = config.GetLogsInfoEnable(info_enable); - if (!s.ok()) { - return s; - } - s = config.GetLogsWarningEnable(warning_enable); - if (!s.ok()) { - return s; - } - s = config.GetLogsErrorEnable(error_enable); - if (!s.ok()) { - return s; - } - s = config.GetLogsFatalEnable(fatal_enable); - if (!s.ok()) { - return s; - } - s = config.GetLogsPath(logs_path); - if (!s.ok()) { - return s; - } - s = config.GetLogsMaxLogFileSize(max_log_file_size); - if (!s.ok()) { - return s; - } - s = config.GetLogsDeleteExceeds(delete_exceeds); - if (!s.ok()) { - return s; - } + CONFIG_CHECK(config.GetLogsTraceEnable(trace_enable)); + CONFIG_CHECK(config.GetLogsDebugEnable(debug_enable)); + CONFIG_CHECK(config.GetLogsInfoEnable(info_enable)); + CONFIG_CHECK(config.GetLogsWarningEnable(warning_enable)); + CONFIG_CHECK(config.GetLogsErrorEnable(error_enable)); + CONFIG_CHECK(config.GetLogsFatalEnable(fatal_enable)); + CONFIG_CHECK(config.GetLogsPath(logs_path)); + CONFIG_CHECK(config.GetLogsMaxLogFileSize(max_log_file_size)); + CONFIG_CHECK(config.GetLogsDeleteExceeds(delete_exceeds)); InitLog(trace_enable, debug_enable, info_enable, warning_enable, error_enable, fatal_enable, logs_path, max_log_file_size, delete_exceeds); }