summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIlya Mashchenko <ilya@netdata.cloud>2024-02-05 18:38:31 +0200
committerTasos Katsoulas <12612986+tkatsoulas@users.noreply.github.com>2024-02-06 16:33:22 +0200
commit76d4423eecde394c3a0474e679ec0d62fd2e6cf3 (patch)
treecc36cff57a88500a5657f83f173820743c6b8e45
parent09711ae4a187896e033d3ebe538c3537500e9a80 (diff)
respect log level for all sources (#16922)
(cherry picked from commit 85b274833bb01e5bdef3e230f4f2e7ec6c8f26e5)
-rw-r--r--libnetdata/log/log.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/libnetdata/log/log.c b/libnetdata/log/log.c
index a7300cf36c..c805716ce1 100644
--- a/libnetdata/log/log.c
+++ b/libnetdata/log/log.c
@@ -660,8 +660,10 @@ void nd_log_set_priority_level(const char *setting) {
priority = NDLP_DEBUG;
#endif
- nd_log.sources[NDLS_DAEMON].min_priority = priority;
- nd_log.sources[NDLS_COLLECTORS].min_priority = priority;
+ for (size_t i = 0; i < _NDLS_MAX; i++) {
+ if (i != NDLS_DEBUG)
+ nd_log.sources[i].min_priority = priority;
+ }
// the right one
setenv("NETDATA_LOG_LEVEL", nd_log_id2priority(priority), 1);
@@ -2226,7 +2228,7 @@ void netdata_logger(ND_LOG_SOURCES source, ND_LOG_FIELD_PRIORITY priority, const
int saved_errno = errno;
source = nd_log_validate_source(source);
- if((source == NDLS_DAEMON || source == NDLS_COLLECTORS) && priority > nd_log.sources[source].min_priority)
+ if (source != NDLS_DEBUG && priority > nd_log.sources[source].min_priority)
return;
va_list args;
@@ -2241,6 +2243,9 @@ void netdata_logger_with_limit(ERROR_LIMIT *erl, ND_LOG_SOURCES source, ND_LOG_F
int saved_errno = errno;
source = nd_log_validate_source(source);
+ if (source != NDLS_DEBUG && priority > nd_log.sources[source].min_priority)
+ return;
+
if(erl->sleep_ut)
sleep_usec(erl->sleep_ut);