summaryrefslogtreecommitdiffstats
path: root/libnetdata/log/log.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2019-02-08 07:30:37 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2019-02-08 07:30:37 +0000
commit8a7b72f7cd1ccd547a03eb4243294e741d661d3f (patch)
tree7bc7be4a8e9e298daa1349348400aa2a653866f2 /libnetdata/log/log.c
parentNew upstream version 1.11.1+dfsg (diff)
downloadnetdata-8a7b72f7cd1ccd547a03eb4243294e741d661d3f.tar.xz
netdata-8a7b72f7cd1ccd547a03eb4243294e741d661d3f.zip
Adding upstream version 1.12.0.upstream/1.12.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'libnetdata/log/log.c')
-rw-r--r--libnetdata/log/log.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/libnetdata/log/log.c b/libnetdata/log/log.c
index 198e98bd9..66a923f85 100644
--- a/libnetdata/log/log.c
+++ b/libnetdata/log/log.c
@@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-3.0-or-later
+#include <daemon/main.h>
#include "../libnetdata.h"
int web_server_is_multithreaded = 1;
@@ -376,6 +377,8 @@ void error_int( const char *prefix, const char *file, const char *function, cons
}
void fatal_int( const char *file, const char *function, const unsigned long line, const char *fmt, ... ) {
+ // save a copy of errno - just in case this function generates a new error
+ int __errno = errno;
va_list args;
if(error_log_syslog) {
@@ -400,6 +403,12 @@ void fatal_int( const char *file, const char *function, const unsigned long line
log_unlock();
+ char action_data[70+1];
+ snprintfz(action_data, 70, "%04lu@%-10.10s:%-15.15s/%d", line, file, function, __errno);
+ char action_result[60+1];
+ snprintfz(action_result, 60, "%s:%s",program_name, netdata_thread_tag());
+ send_statistics("FATAL", action_result, action_data);
+
netdata_cleanup_and_exit(1);
}