From 4d64f0cf062f3cb88a49ead006659c3d537d1c8c Mon Sep 17 00:00:00 2001 From: yangwei Date: Thu, 1 Dec 2022 16:00:28 +0800 Subject: 🐞 fix(g_zlog_inited): 修复多次creation时报错,改为reload MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/MESA_handle_logger.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/MESA_handle_logger.c b/src/MESA_handle_logger.c index 8327124..473361c 100644 --- a/src/MESA_handle_logger.c +++ b/src/MESA_handle_logger.c @@ -235,6 +235,14 @@ int MESA_handle_runtime_log_creation(const char *conf_path) { char *env = getenv("ZLOG_CONF_PATH"); int rc = 0; + + if(g_zlog_inited == 1) + { + rc = zlog_reload(conf_path); + zlog_profile(); + return rc; + } + if (conf_path == NULL || (access(conf_path, R_OK) != 0)) { fprintf(stderr,"[MESA_handle_runtime_log_creation], PATH (%s) unable to access, will output log to STDOUT or Using ZLOG_CONF_PATH (%s) !\n", conf_path, env); @@ -327,4 +335,5 @@ void MESA_handle_runtime_log_destruction() unlink(tmp_conf_filepath); close(g_zlog_conf_fp); } + g_zlog_inited=0; } -- cgit v1.2.3