This is an automated email from the ASF dual-hosted git repository.

laiyingchun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pegasus.git


The following commit(s) were added to refs/heads/master by this push:
     new 117f604f3 fix(logs): fix logs in FATAL level not take effect (#1573)
117f604f3 is described below

commit 117f604f3c48b8b88f1d9a2f03eefae3d45d6741
Author: Yingchun Lai <[email protected]>
AuthorDate: Mon Jul 31 15:49:29 2023 +0800

    fix(logs): fix logs in FATAL level not take effect (#1573)
    
    https://github.com/apache/incubator-pegasus/issues/1572
    
    If the logs are called in FATAL level, the process should exit.
---
 src/utils/simple_logger.cpp | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/utils/simple_logger.cpp b/src/utils/simple_logger.cpp
index f98267018..f6a21b16d 100644
--- a/src/utils/simple_logger.cpp
+++ b/src/utils/simple_logger.cpp
@@ -112,6 +112,10 @@ void screen_logger::dsn_logv(const char *file,
     }
     vprintf(fmt, args);
     printf("\n");
+
+    if (dsn_unlikely(log_level >= LOG_LEVEL_FATAL)) {
+        dsn_coredump();
+    }
 }
 
 void screen_logger::flush() { ::fflush(stdout); }
@@ -287,6 +291,10 @@ void simple_logger::dsn_log(const char *file,
         printf("%s\n", str);
     }
 
+    if (dsn_unlikely(log_level >= LOG_LEVEL_FATAL)) {
+        dsn_coredump();
+    }
+
     if (++_lines >= 200000) {
         create_log_file();
     }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to