diff options
author | Ilya Mashchenko <ilya@netdata.cloud> | 2024-02-06 13:14:56 +0200 |
---|---|---|
committer | Tasos Katsoulas <12612986+tkatsoulas@users.noreply.github.com> | 2024-02-06 16:33:22 +0200 |
commit | ddd7464e7a1ebf69617a51d3f1e5baa3d58c30bf (patch) | |
tree | 5894b7b438b692e531095133c7bbf63e7db731cb | |
parent | 76d4423eecde394c3a0474e679ec0d62fd2e6cf3 (diff) |
respect NETDATA_LOG_LEVEL if set (#16943)
(cherry picked from commit 65579feafe19d9f97108ec012eac5be79235e32e)
-rw-r--r-- | daemon/main.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/daemon/main.c b/daemon/main.c index 45c65384ff..4051070aba 100644 --- a/daemon/main.c +++ b/daemon/main.c @@ -869,7 +869,10 @@ static void log_init(void) { logs = (unsigned long)config_get_number(CONFIG_SECTION_LOGS, "logs to trigger flood protection", (long long int)logs); nd_log_set_flood_protection(logs, period); - nd_log_set_priority_level(config_get(CONFIG_SECTION_LOGS, "level", NDLP_INFO_STR)); + const char *netdata_log_level = getenv("NETDATA_LOG_LEVEL"); + netdata_log_level = netdata_log_level ? nd_log_id2priority(nd_log_priority2id(netdata_log_level)) : NDLP_INFO_STR; + + nd_log_set_priority_level(config_get(CONFIG_SECTION_LOGS, "level", netdata_log_level)); char filename[FILENAME_MAX + 1]; snprintfz(filename, FILENAME_MAX, "%s/debug.log", netdata_configured_log_dir); |