This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new b9018009638 [Fix] Support BE log sys_log_level modify to take effect
dynamically (apache#26060) (#28203)
b9018009638 is described below
commit b901800963816be3747cb723260655114432cf38
Author: Guangming Lu <[email protected]>
AuthorDate: Wed Dec 13 11:08:48 2023 +0800
[Fix] Support BE log sys_log_level modify to take effect dynamically
(apache#26060) (#28203)
---
be/src/common/config.cpp | 10 +++++++++-
be/src/common/config.h | 2 ++
be/src/common/logconfig.cpp | 16 ++++++++++++++++
be/src/common/logging.h | 2 ++
4 files changed, 29 insertions(+), 1 deletion(-)
diff --git a/be/src/common/config.cpp b/be/src/common/config.cpp
index c97959f2e4a..7dbafcc62b7 100644
--- a/be/src/common/config.cpp
+++ b/be/src/common/config.cpp
@@ -203,7 +203,7 @@ DEFINE_Int32(sleep_one_second, "1");
DEFINE_String(sys_log_dir, "${DORIS_HOME}/log");
DEFINE_String(user_function_dir, "${DORIS_HOME}/lib/udf");
// INFO, WARNING, ERROR, FATAL
-DEFINE_String(sys_log_level, "INFO");
+DEFINE_mString(sys_log_level, "INFO");
// TIME-DAY, TIME-HOUR, SIZE-MB-nnn
DEFINE_String(sys_log_roll_mode, "SIZE-MB-1024");
// log roll num
@@ -1503,6 +1503,7 @@ bool init(const char* conf_file, bool fill_conf_map, bool
must_exist, bool set_t
if (PERSIST) {
\
RETURN_IF_ERROR(persist_config(std::string((FIELD).name), VALUE));
\
}
\
+ update_config(std::string((FIELD).name), VALUE);
\
return Status::OK();
\
}
@@ -1552,6 +1553,13 @@ Status set_config(const std::string& field, const
std::string& value, bool need_
"'{}' is type of '{}' which is not support to modify", field,
it->second.type);
}
+void update_config(const std::string& field, const std::string& value) {
+ if ("sys_log_level" == field) {
+ // update log level
+ update_logging(field, value);
+ }
+}
+
Status set_fuzzy_config(const std::string& field, const std::string& value) {
LOG(INFO) << fmt::format("FUZZY MODE: {} has been set to {}", field,
value);
return set_config(field, value, false, true);
diff --git a/be/src/common/config.h b/be/src/common/config.h
index e3dbe3234c4..f4f28450980 100644
--- a/be/src/common/config.h
+++ b/be/src/common/config.h
@@ -1336,5 +1336,7 @@ Status set_fuzzy_config(const std::string& field, const
std::string& value);
void set_fuzzy_configs();
+void update_config(const std::string& field, const std::string& value);
+
} // namespace config
} // namespace doris
diff --git a/be/src/common/logconfig.cpp b/be/src/common/logconfig.cpp
index fc81103254a..1c53035317a 100644
--- a/be/src/common/logconfig.cpp
+++ b/be/src/common/logconfig.cpp
@@ -151,4 +151,20 @@ void shutdown_logging() {
google::ShutdownGoogleLogging();
}
+void update_logging(const std::string& name, const std::string& value) {
+ if ("sys_log_level" == name) {
+ if (iequals(value, "INFO")) {
+ FLAGS_minloglevel = 0;
+ } else if (iequals(value, "WARNING")) {
+ FLAGS_minloglevel = 1;
+ } else if (iequals(value, "ERROR")) {
+ FLAGS_minloglevel = 2;
+ } else if (iequals(value, "FATAL")) {
+ FLAGS_minloglevel = 3;
+ } else {
+ LOG(WARNING) << "update sys_log_level failed, need to be INFO,
WARNING, ERROR, FATAL";
+ }
+ }
+}
+
} // namespace doris
diff --git a/be/src/common/logging.h b/be/src/common/logging.h
index 268e803fc29..672edb84e6a 100644
--- a/be/src/common/logging.h
+++ b/be/src/common/logging.h
@@ -72,6 +72,8 @@ bool init_glog(const char* basename);
// flushed. May only be called once.
void shutdown_logging();
+void update_logging(const std::string& name, const std::string& value);
+
class TaggableLogger {
public:
TaggableLogger(const char* file, int line, google::LogSeverity severity)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]