diff options
Diffstat (limited to 'daemon')
-rw-r--r-- | daemon/analytics.c | 18 | ||||
-rw-r--r-- | daemon/commands.c | 46 | ||||
-rw-r--r-- | daemon/daemon.c | 20 | ||||
-rw-r--r-- | daemon/global_statistics.c | 6 | ||||
-rw-r--r-- | daemon/main.c | 46 | ||||
-rw-r--r-- | daemon/service.c | 6 | ||||
-rw-r--r-- | daemon/signals.c | 26 |
7 files changed, 84 insertions, 84 deletions
diff --git a/daemon/analytics.c b/daemon/analytics.c index cbe6ded79d..a3900be623 100644 --- a/daemon/analytics.c +++ b/daemon/analytics.c @@ -314,7 +314,7 @@ void analytics_alarms_notifications(void) sizeof(char) * (strlen(netdata_configured_primary_plugins_dir) + strlen("alarm-notify.sh dump_methods") + 2)); sprintf(script, "%s/%s", netdata_configured_primary_plugins_dir, "alarm-notify.sh"); if (unlikely(access(script, R_OK) != 0)) { - info("Alarm notify script %s not found.", script); + netdata_log_info("Alarm notify script %s not found.", script); freez(script); return; } @@ -709,13 +709,13 @@ void get_system_timezone(void) // use the TZ variable if (tz && *tz && *tz != ':') { timezone = tz; - info("TIMEZONE: using TZ variable '%s'", timezone); + netdata_log_info("TIMEZONE: using TZ variable '%s'", timezone); } // use the contents of /etc/timezone if (!timezone && !read_file("/etc/timezone", buffer, FILENAME_MAX)) { timezone = buffer; - info("TIMEZONE: using the contents of /etc/timezone"); + netdata_log_info("TIMEZONE: using the contents of /etc/timezone"); } // read the link /etc/localtime @@ -731,7 +731,7 @@ void get_system_timezone(void) char *s = strstr(buffer, cmp); if (s && s[cmp_len]) { timezone = &s[cmp_len]; - info("TIMEZONE: using the link of /etc/localtime: '%s'", timezone); + netdata_log_info("TIMEZONE: using the link of /etc/localtime: '%s'", timezone); } } else buffer[0] = '\0'; @@ -751,14 +751,14 @@ void get_system_timezone(void) else { buffer[FILENAME_MAX] = '\0'; timezone = buffer; - info("TIMEZONE: using strftime(): '%s'", timezone); + netdata_log_info("TIMEZONE: using strftime(): '%s'", timezone); } } } if (timezone && *timezone) { // make sure it does not have illegal characters - // info("TIMEZONE: fixing '%s'", timezone); + // netdata_log_info("TIMEZONE: fixing '%s'", timezone); size_t len = strlen(timezone); char tmp[len + 1]; @@ -774,7 +774,7 @@ void get_system_timezone(void) *d = '\0'; strncpyz(buffer, tmp, len); timezone = buffer; - info("TIMEZONE: fixed as '%s'", timezone); + netdata_log_info("TIMEZONE: fixed as '%s'", timezone); } if (!timezone || !*timezone) @@ -955,7 +955,7 @@ void send_statistics(const char *action, const char *action_result, const char * sprintf(as_script, "%s/%s", netdata_configured_primary_plugins_dir, "anonymous-statistics.sh"); if (unlikely(access(as_script, R_OK) != 0)) { netdata_anonymous_statistics_enabled = 0; - info("Anonymous statistics script %s not found.", as_script); + netdata_log_info("Anonymous statistics script %s not found.", as_script); freez(as_script); } else { netdata_anonymous_statistics_enabled = 1; @@ -1026,7 +1026,7 @@ void send_statistics(const char *action, const char *action_result, const char * analytics_data.netdata_config_oom_score, analytics_data.netdata_prebuilt_distro); - info("%s '%s' '%s' '%s'", as_script, action, action_result, action_data); + netdata_log_info("%s '%s' '%s' '%s'", as_script, action, action_result, action_data); FILE *fp_child_input; FILE *fp_child_output = netdata_popen(command_to_run, &command_pid, &fp_child_input); diff --git a/daemon/commands.c b/daemon/commands.c index 5e55ed5c2f..6ef36ee5f4 100644 --- a/daemon/commands.c +++ b/daemon/commands.c @@ -143,7 +143,7 @@ static cmd_status_t cmd_reload_health_execute(char *args, char **message) (void)message; error_log_limit_unlimited(); - info("COMMAND: Reloading HEALTH configuration."); + netdata_log_info("COMMAND: Reloading HEALTH configuration."); health_reload(); error_log_limit_reset(); @@ -156,9 +156,9 @@ static cmd_status_t cmd_save_database_execute(char *args, char **message) (void)message; error_log_limit_unlimited(); - info("COMMAND: Saving databases."); + netdata_log_info("COMMAND: Saving databases."); rrdhost_save_all(); - info("COMMAND: Databases saved."); + netdata_log_info("COMMAND: Databases saved."); error_log_limit_reset(); return CMD_STATUS_SUCCESS; @@ -170,7 +170,7 @@ static cmd_status_t cmd_reopen_logs_execute(char *args, char **message) (void)message; error_log_limit_unlimited(); - info("COMMAND: Reopening all log files."); + netdata_log_info("COMMAND: Reopening all log files."); reopen_all_log_files(); error_log_limit_reset(); @@ -183,7 +183,7 @@ static cmd_status_t cmd_exit_execute(char *args, char **message) (void)message; error_log_limit_unlimited(); - info("COMMAND: Cleaning up to exit."); + netdata_log_info("COMMAND: Cleaning up to exit."); netdata_cleanup_and_exit(0); exit(0); @@ -205,12 +205,12 @@ static cmd_status_t cmd_reload_claiming_state_execute(char *args, char **message (void)args; (void)message; #if defined(DISABLE_CLOUD) || !defined(ENABLE_ACLK) - info("The claiming feature has been explicitly disabled"); + netdata_log_info("The claiming feature has been explicitly disabled"); *message = strdupz("This agent cannot be claimed, it was built without support for Cloud"); return CMD_STATUS_FAILURE; #endif error_log_limit_unlimited(); - info("COMMAND: Reloading Agent Claiming configuration."); + netdata_log_info("COMMAND: Reloading Agent Claiming configuration."); load_claiming_state(); registry_update_cloud_base_url(); rrdpush_send_claimed_id(localhost); @@ -221,7 +221,7 @@ static cmd_status_t cmd_reload_claiming_state_execute(char *args, char **message static cmd_status_t cmd_reload_labels_execute(char *args, char **message) { (void)args; - info("COMMAND: reloading host labels."); + netdata_log_info("COMMAND: reloading host labels."); reload_host_labels(); BUFFER *wb = buffer_create(10, NULL); @@ -272,7 +272,7 @@ static cmd_status_t cmd_read_config_execute(char *args, char **message) static cmd_status_t cmd_write_config_execute(char *args, char **message) { UNUSED(message); - info("write-config %s", args); + netdata_log_info("write-config %s", args); size_t n = strlen(args); char *separator = strchr(args,'|'); if (separator == NULL) @@ -296,7 +296,7 @@ static cmd_status_t cmd_write_config_execute(char *args, char **message) struct config *tmp_config = strcmp(conf_file, "cloud") ? &netdata_config : &cloud_config; appconfig_set(tmp_config, temp + offset + 1, temp + offset2 + 1, temp + offset3 + 1); - info("write-config conf_file=%s section=%s key=%s value=%s",conf_file, temp + offset + 1, temp + offset2 + 1, + netdata_log_info("write-config conf_file=%s section=%s key=%s value=%s",conf_file, temp + offset + 1, temp + offset2 + 1, temp + offset3 + 1); freez(temp); return CMD_STATUS_SUCCESS; @@ -313,7 +313,7 @@ static cmd_status_t cmd_ping_execute(char *args, char **message) static cmd_status_t cmd_aclk_state(char *args, char **message) { - info("COMMAND: Reopening aclk/cloud state."); + netdata_log_info("COMMAND: Reopening aclk/cloud state."); if (strstr(args, "json")) *message = aclk_state_json(); else @@ -409,7 +409,7 @@ static void pipe_write_cb(uv_write_t* req, int status) uv_close((uv_handle_t *)client, pipe_close_cb); --clients; buffer_free(client->data); - info("Command Clients = %u\n", clients); + netdata_log_info("Command Clients = %u\n", clients); } static inline void add_char_to_command_reply(BUFFER *reply_string, unsigned *reply_string_size, char character) @@ -534,9 +534,9 @@ static void pipe_read_cb(uv_stream_t *client, ssize_t nread, const uv_buf_t *buf struct command_context *cmd_ctx = (struct command_context *)client; if (0 == nread) { - info("%s: Zero bytes read by command pipe.", __func__); + netdata_log_info("%s: Zero bytes read by command pipe.", __func__); } else if (UV_EOF == nread) { - info("EOF found in command pipe."); + netdata_log_info("EOF found in command pipe."); parse_commands(cmd_ctx); } else if (nread < 0) { error("%s: %s", __func__, uv_strerror(nread)); @@ -559,7 +559,7 @@ static void pipe_read_cb(uv_stream_t *client, ssize_t nread, const uv_buf_t *buf if (nread < 0 && UV_EOF != nread) { uv_close((uv_handle_t *)client, pipe_close_cb); --clients; - info("Command Clients = %u\n", clients); + netdata_log_info("Command Clients = %u\n", clients); } } @@ -595,7 +595,7 @@ static void connection_cb(uv_stream_t *server, int status) } ++clients; - info("Command Clients = %u\n", clients); + netdata_log_info("Command Clients = %u\n", clients); /* Start parsing a new command */ cmd_ctx->command_string_size = 0; cmd_ctx->command_string[0] = '\0'; @@ -605,7 +605,7 @@ static void connection_cb(uv_stream_t *server, int status) error("uv_read_start(): %s", uv_strerror(ret)); uv_close((uv_handle_t *)client, pipe_close_cb); --clients; - info("Command Clients = %u\n", clients); + netdata_log_info("Command Clients = %u\n", clients); return; } } @@ -659,7 +659,7 @@ static void command_thread(void *arg) ret = uv_listen((uv_stream_t *)&server_pipe, SOMAXCONN, connection_cb); if (ret) { /* Fallback to backlog of 1 */ - info("uv_listen() failed with backlog = %d, falling back to backlog = 1.", SOMAXCONN); + netdata_log_info("uv_listen() failed with backlog = %d, falling back to backlog = 1.", SOMAXCONN); ret = uv_listen((uv_stream_t *)&server_pipe, 1, connection_cb); } if (ret) { @@ -677,12 +677,12 @@ static void command_thread(void *arg) uv_run(loop, UV_RUN_DEFAULT); } /* cleanup operations of the event loop */ - info("Shutting down command event loop."); + netdata_log_info("Shutting down command event loop."); uv_close((uv_handle_t *)&async, NULL); uv_close((uv_handle_t*)&server_pipe, NULL); uv_run(loop, UV_RUN_DEFAULT); /* flush all libuv handles */ - info("Shutting down command loop complete."); + netdata_log_info("Shutting down command loop complete."); fatal_assert(0 == uv_loop_close(loop)); freez(loop); @@ -718,7 +718,7 @@ void commands_init(void) if (command_server_initialized) return; - info("Initializing command server."); + netdata_log_info("Initializing command server."); for (i = 0 ; i < CMD_TOTAL_COMMANDS ; ++i) { fatal_assert(0 == uv_mutex_init(&command_lock_array[i])); } @@ -758,7 +758,7 @@ void commands_exit(void) return; command_thread_shutdown = 1; - info("Shutting down command server."); + netdata_log_info("Shutting down command server."); /* wake up event loop */ fatal_assert(0 == uv_async_send(&async)); fatal_assert(0 == uv_thread_join(&thread)); @@ -767,6 +767,6 @@ void commands_exit(void) uv_mutex_destroy(&command_lock_array[i]); } uv_rwlock_destroy(&exclusive_rwlock); - info("Command server has stopped."); + netdata_log_info("Command server has stopped."); command_server_initialized = 0; } diff --git a/daemon/daemon.c b/daemon/daemon.c index 4b6679cdeb..e3287a70ac 100644 --- a/daemon/daemon.c +++ b/daemon/daemon.c @@ -121,7 +121,7 @@ int become_user(const char *username, int pid_fd) { gid_t gid = pw->pw_gid; if (am_i_root) - info("I am root, so checking permissions"); + netdata_log_info("I am root, so checking permissions"); prepare_required_directories(uid, gid); @@ -234,11 +234,11 @@ static void oom_score_adj(void) { if(s && *s && (isdigit(*s) || *s == '-' || *s == '+')) wanted_score = atoll(s); else if(s && !strcmp(s, "keep")) { - info("Out-Of-Memory (OOM) kept as-is (running with %d)", (int) old_score); + netdata_log_info("Out-Of-Memory (OOM) kept as-is (running with %d)", (int) old_score); return; } else { - info("Out-Of-Memory (OOM) score not changed due to non-numeric setting: '%s' (running with %d)", s, (int)old_score); + netdata_log_info("Out-Of-Memory (OOM) score not changed due to non-numeric setting: '%s' (running with %d)", s, (int)old_score); return; } @@ -253,7 +253,7 @@ static void oom_score_adj(void) { } if(old_score == wanted_score) { - info("Out-Of-Memory (OOM) score is already set to the wanted value %d", (int)old_score); + netdata_log_info("Out-Of-Memory (OOM) score is already set to the wanted value %d", (int)old_score); return; } @@ -269,7 +269,7 @@ static void oom_score_adj(void) { if(read_single_signed_number_file("/proc/self/oom_score_adj", &final_score)) error("Adjusted my Out-Of-Memory (OOM) score to %d, but cannot verify it.", (int)wanted_score); else if(final_score == wanted_score) - info("Adjusted my Out-Of-Memory (OOM) score from %d to %d.", (int)old_score, (int)final_score); + netdata_log_info("Adjusted my Out-Of-Memory (OOM) score from %d to %d.", (int)old_score, (int)final_score); else error("Adjusted my Out-Of-Memory (OOM) score from %d to %d, but it has been set to %d.", (int)old_score, (int)wanted_score, (int)final_score); analytics_report_oom_score(final_score); @@ -355,19 +355,19 @@ static void sched_getscheduler_report(void) { return; } else { - info("Running with process scheduling policy '%s', priority %d", scheduler_defaults[i].name, param.sched_priority); + netdata_log_info("Running with process scheduling policy '%s', priority %d", scheduler_defaults[i].name, param.sched_priority); } } else if(scheduler_defaults[i].flags & SCHED_FLAG_USE_NICE) { #ifdef HAVE_GETPRIORITY int n = getpriority(PRIO_PROCESS, 0); - info("Running with process scheduling policy '%s', nice level %d", scheduler_defaults[i].name, n); + netdata_log_info("Running with process scheduling policy '%s', nice level %d", scheduler_defaults[i].name, n); #else // !HAVE_GETPRIORITY - info("Running with process scheduling policy '%s'", scheduler_defaults[i].name); + netdata_log_info("Running with process scheduling policy '%s'", scheduler_defaults[i].name); #endif // !HAVE_GETPRIORITY } else { - info("Running with process scheduling policy '%s'", scheduler_defaults[i].name); + netdata_log_info("Running with process scheduling policy '%s'", scheduler_defaults[i].name); } return; @@ -436,7 +436,7 @@ static void sched_setscheduler_set(void) { error("Cannot adjust netdata scheduling policy to %s (%d), with priority %d. Falling back to nice.", name, policy, priority); } else { - info("Adjusted netdata scheduling policy to %s (%d), with priority %d.", name, policy, priority); + netdata_log_info("Adjusted netdata scheduling policy to %s (%d), with priority %d.", name, policy, priority); if(!(flags & SCHED_FLAG_USE_NICE)) goto report; } diff --git a/daemon/global_statistics.c b/daemon/global_statistics.c index 2ae20ab71f..b1c5ee530e 100644 --- a/daemon/global_statistics.c +++ b/daemon/global_statistics.c @@ -4123,7 +4123,7 @@ static void global_statistics_cleanup(void *ptr) struct netdata_static_thread *static_thread = (struct netdata_static_thread *)ptr; static_thread->enabled = NETDATA_MAIN_THREAD_EXITING; - info("cleaning up..."); + netdata_log_info("cleaning up..."); static_thread->enabled = NETDATA_MAIN_THREAD_EXITED; } @@ -4194,7 +4194,7 @@ static void global_statistics_workers_cleanup(void *ptr) struct netdata_static_thread *static_thread = (struct netdata_static_thread *)ptr; static_thread->enabled = NETDATA_MAIN_THREAD_EXITING; - info("cleaning up..."); + netdata_log_info("cleaning up..."); worker_utilization_finish(); @@ -4238,7 +4238,7 @@ static void global_statistics_sqlite3_cleanup(void *ptr) struct netdata_static_thread *static_thread = (struct netdata_static_thread *)ptr; static_thread->enabled = NETDATA_MAIN_THREAD_EXITING; - info("cleaning up..."); + netdata_log_info("cleaning up..."); static_thread->enabled = NETDATA_MAIN_THREAD_EXITED; } diff --git a/daemon/main.c b/daemon/main.c index eb8e70d2a9..b5a89b6132 100644 --- a/daemon/main.c +++ b/daemon/main.c @@ -265,7 +265,7 @@ static bool service_wait_exit(SERVICE_TYPE service, usec_t timeout_ut) { buffer_flush(service_list); service_to_buffer(service_list, running_services); - info("SERVICE CONTROL: waiting for the following %zu services [ %s] to exit: %s", + netdata_log_info("SERVICE CONTROL: waiting for the following %zu services [ %s] to exit: %s", running, buffer_tostring(service_list), running <= 10 ? buffer_tostring(thread_list) : ""); } @@ -280,7 +280,7 @@ static bool service_wait_exit(SERVICE_TYPE service, usec_t timeout_ut) { if(running) { buffer_flush(service_list); service_to_buffer(service_list, running_services); - info("SERVICE CONTROL: " + netdata_log_info("SERVICE CONTROL: " "the following %zu service(s) [ %s] take too long to exit: %s; " "giving up on them...", running, buffer_tostring(service_list), @@ -297,9 +297,9 @@ static bool service_wait_exit(SERVICE_TYPE service, usec_t timeout_ut) { { \ usec_t now_ut = now_monotonic_usec(); \ if(prev_msg) \ - info("NETDATA SHUTDOWN: in %7llu ms, %s%s - next: %s", (now_ut - last_ut) / USEC_PER_MS, (timeout)?"(TIMEOUT) ":"", prev_msg, msg); \ + netdata_log_info("NETDATA SHUTDOWN: in %7llu ms, %s%s - next: %s", (now_ut - last_ut) / USEC_PER_MS, (timeout)?"(TIMEOUT) ":"", prev_msg, msg); \ else \ - info("NETDATA SHUTDOWN: next: %s", msg); \ + netdata_log_info("NETDATA SHUTDOWN: next: %s", msg); \ last_ut = now_ut; \ prev_msg = msg; \ timeout = false; \ @@ -314,7 +314,7 @@ void netdata_cleanup_and_exit(int ret) { bool timeout = false; error_log_limit_unlimited(); - info("NETDATA SHUTDOWN: initializing shutdown with code %d...", ret); + netdata_log_info("NETDATA SHUTDOWN: initializing shutdown with code %d...", ret); send_statistics("EXIT", ret?"ERROR":"OK","-"); @@ -494,7 +494,7 @@ void netdata_cleanup_and_exit(int ret) { delta_shutdown_time("exit"); usec_t ended_ut = now_monotonic_usec(); - info("NETDATA SHUTDOWN: completed in %llu ms - netdata is now exiting - bye bye...", (ended_ut - started_ut) / USEC_PER_MS); + netdata_log_info("NETDATA SHUTDOWN: completed in %llu ms - netdata is now exiting - bye bye...", (ended_ut - started_ut) / USEC_PER_MS); exit(ret); } @@ -641,7 +641,7 @@ static void set_nofile_limit(struct rlimit *rl) { return; } - info("resources control: allowed file descriptors: soft = %zu, max = %zu", + netdata_log_info("resources control: allowed file descriptors: soft = %zu, max = %zu", (size_t) rl->rlim_cur, (size_t) rl->rlim_max); // make the soft/hard limits equal @@ -668,10 +668,10 @@ void cancel_main_threads() { for (i = 0; static_threads[i].name != NULL ; i++) { if (static_threads[i].enabled == NETDATA_MAIN_THREAD_RUNNING) { if (static_threads[i].thread) { - info("EXIT: Stopping main thread: %s", static_threads[i].name); + netdata_log_info("EXIT: Stopping main thread: %s", static_threads[i].name); netdata_thread_cancel(*static_threads[i].thread); } else { - info("EXIT: No thread running (marking as EXITED): %s", static_threads[i].name); + netdata_log_info("EXIT: No thread running (marking as EXITED): %s", static_threads[i].name); static_threads[i].enabled = NETDATA_MAIN_THREAD_EXITED; } found++; @@ -682,7 +682,7 @@ void cancel_main_threads() { while(found && max > 0) { max -= step; - info("Waiting %d threads to finish...", found); + netdata_log_info("Waiting %d threads to finish...", found); sleep_usec(step); found = 0; for (i = 0; static_threads[i].name != NULL ; i++) { @@ -698,7 +698,7 @@ void cancel_main_threads() { } } else - info("All threads finished."); + netdata_log_info("All threads finished."); for (i = 0; static_threads[i].name != NULL ; i++) freez(static_threads[i].thread); @@ -1185,7 +1185,7 @@ static void get_netdata_configured_variables() { // https://github.com/netdata/netdata/pull/11222#issuecomment-868367920 for more information. if (rrdset_free_obsolete_time_s < 10) { rrdset_free_obsolete_time_s = 10; - info("The \"cleanup obsolete charts after seconds\" option was set to 10 seconds."); + netdata_log_info("The \"cleanup obsolete charts after seconds\" option was set to 10 seconds."); config_set_number(CONFIG_SECTION_DB, "cleanup obsolete charts after secs", rrdset_free_obsolete_time_s); } @@ -1221,13 +1221,13 @@ int load_netdata_conf(char *filename, char overwrite_used) { ret = config_load(filename, overwrite_used, NULL); if(!ret) { - info("CONFIG: cannot load user config '%s'. Will try the stock version.", filename); + netdata_log_info("CONFIG: cannot load user config '%s'. Will try the stock version.", filename); freez(filename); filename = strdupz_path_subpath(netdata_configured_stock_config_dir, "netdata.conf"); ret = config_load(filename, overwrite_used, NULL); if(!ret) - info("CONFIG: cannot load stock config '%s'. Running with internal defaults.", filename); + netdata_log_info("CONFIG: cannot load stock config '%s'. Running with internal defaults.", filename); } freez(filename); @@ -1247,14 +1247,14 @@ int get_system_info(struct rrdhost_system_info *system_info) { script = mallocz(sizeof(char) * (strlen(netdata_configured_primary_plugins_dir) + strlen("system-info.sh") + 2)); sprintf(script, "%s/%s", netdata_configured_primary_plugins_dir, "system-info.sh"); if (unlikely(access(script, R_OK) != 0)) { - info("System info script %s not found.",script); + netdata_log_info("System info script %s not found.",script); freez(script); return 1; } pid_t command_pid; - info("Executing %s", script); + netdata_log_info("Executing %s", script); FILE *fp_child_input; FILE *fp_child_output = netdata_popen(script, &command_pid, &fp_child_input); @@ -1275,10 +1275,10 @@ int get_system_info(struct rrdhost_system_info *system_info) { coverity_remove_taint(value); if(unlikely(rrdhost_set_system_info_variable(system_info, line, value))) { - info("Unexpected environment variable %s=%s", line, value); + netdata_log_info("Unexpected environment variable %s=%s", line, value); } else { - info("%s=%s", line, value); + netdata_log_info("%s=%s", line, value); setenv(line, value, 1); } } @@ -1327,9 +1327,9 @@ void post_conf_load(char **user) { \ usec_t now_ut = now_monotonic_usec(); \ if(prev_msg) \ - info("NETDATA STARTUP: in %7llu ms, %s - next: %s", (now_ut - last_ut) / USEC_PER_MS, prev_msg, msg); \ + netdata_log_info("NETDATA STARTUP: in %7llu ms, %s - next: %s", (now_ut - last_ut) / USEC_PER_MS, prev_msg, msg); \ else \ - info("NETDATA STARTUP: next: %s", msg); \ + netdata_log_info("NETDATA STARTUP: next: %s", msg); \ last_ut = now_ut; \ prev_msg = msg; \ } @@ -1349,7 +1349,7 @@ int main(int argc, char **argv) { usec_t started_ut = now_monotonic_usec(); usec_t last_ut = started_ut; const char *prev_msg = NULL; - // Initialize stderror avoiding coredump when info() or error() is called + // Initialize stderror avoiding coredump when netdata_log_info() or error() is called stderror = stderr; int i; @@ -2018,7 +2018,7 @@ int main(int argc, char **argv) { if(become_daemon(dont_fork, user) == -1) fatal("Cannot daemonize myself."); - info("netdata started on pid %d.", getpid()); + netdata_log_info("netdata started on pid %d.", getpid()); delta_startup_time("initialize threads after fork"); @@ -2124,7 +2124,7 @@ int main(int argc, char **argv) { delta_startup_time("ready"); usec_t ready_ut = now_monotonic_usec(); - info("NETDATA STARTUP: completed in %llu ms. Enjoy real-time performance monitoring!", (ready_ut - started_ut) / USEC_PER_MS); + netdata_log_info("NETDATA STARTUP: completed in %llu ms. Enjoy real-time performance monitoring!", (ready_ut - started_ut) / USEC_PER_MS); netdata_ready = true; send_statistics("START", "-", "-"); diff --git a/daemon/service.c b/daemon/service.c index 57c7c7f398..a551ba84c3 100644 --- a/daemon/service.c +++ b/daemon/service.c @@ -40,7 +40,7 @@ static void svc_rrddim_obsolete_to_archive(RRDDIM *rd) { const char *cache_filename = rrddim_cache_filename(rd); if(cache_filename) { - info("Deleting dimension file '%s'.", cache_filename); + netdata_log_info("Deleting dimension file '%s'.", cache_filename); if (unlikely(unlink(cache_filename) == -1)) error("Cannot delete dimension file '%s'", cache_filename); } @@ -91,7 +91,7 @@ static bool svc_rrdset_archive_obsolete_dimensions(RRDSET *st, bool all_dimensio )) { if(dictionary_acquired_item_references(rd_dfe.item) == 1) { - info("Removing obsolete dimension '%s' (%s) of '%s' (%s).", rrddim_name(rd), rrddim_id(rd), rrdset_name(st), rrdset_id(st)); + netdata_log_info("Removing obsolete dimension '%s' (%s) of '%s' (%s).", rrddim_name(rd), rrddim_id(rd), rrdset_name(st), rrdset_id(st)); svc_rrddim_obsolete_to_archive(rd); } else @@ -227,7 +227,7 @@ restart_after_removal: if(!rrdhost_should_be_removed(host, protected_host, now)) continue; - info("Host '%s' with machine guid '%s' is obsolete - cleaning up.", rrdhost_hostname(host), host->machine_guid); + netdata_log_info("Host '%s' with machine guid '%s' is obsolete - cleaning up.", rrdhost_hostname(host), host->machine_guid); if (rrdhost_option_check(host, RRDHOST_OPTION_DELETE_ORPHAN_HOST) /* don't delete multi-host DB host files */ diff --git a/daemon/signals.c b/daemon/signals.c index 3699010ce6..4ef8124140 100644 --- a/daemon/signals.c +++ b/daemon/signals.c @@ -130,7 +130,7 @@ static void reap_child(pid_t pid) { if (errno != ECHILD) error("SIGNAL: waitid(%d): failed to wait for child", pid); else - info("SIGNAL: waitid(%d): failed - it seems the child is already reaped", pid); + netdata_log_info("SIGNAL: waitid(%d): failed - it seems the child is already reaped", pid); return; } else if (i.si_pid == 0) { @@ -141,25 +141,25 @@ static void reap_child(pid_t pid) { switch (i.si_code) { case CLD_EXITED: - info("SIGNAL: reap_child(%d) exited with code: %d", pid, i.si_status); + netdata_log_info("SIGNAL: reap_child(%d) exited with code: %d", pid, i.si_status); break; case CLD_KILLED: - info("SIGNAL: reap_child(%d) killed by signal: %d", pid, i.si_status); + netdata_log_info("SIGNAL: reap_child(%d) killed by signal: %d", pid, i.si_status); break; case CLD_DUMPED: - info("SIGNAL: reap_child(%d) dumped core by signal: %d", pid, i.si_status); + netdata_log_info("SIGNAL: reap_child(%d) dumped core by signal: %d", pid, i.si_status); break; case CLD_STOPPED: - info("SIGNAL: reap_child(%d) stopped by signal: %d", pid, i.si_status); + netdata_log_info("SIGNAL: reap_child(%d) stopped by signal: %d", pid, i.si_status); break; case CLD_TRAPPED: - info("SIGNAL: reap_child(%d) trapped by signal: %d", pid, i.si_status); + netdata_log_info("SIGNAL: reap_child(%d) trapped by signal: %d", pid, i.si_status); break; case CLD_CONTINUED: - info("SIGNAL: reap_child(%d) continued by signal: %d", pid, i.si_status); + netdata_log_info("SIGNAL: reap_child(%d) continued by signal: %d", pid, i.si_status); break; default: - info("SIGNAL: reap_child(%d) gave us a SIGCHLD with code %d and status %d.", pid, i.si_code, i.si_status); + netdata_log_info("SIGNAL: reap_child(%d) gave us a SIGCHLD with code %d and status %d.", pid, i.si_code, i.si_status); break; } } @@ -204,28 +204,28 @@ void signals_handle(void) { switch (signals_waiting[i].action) { case NETDATA_SIGNAL_RELOAD_HEALTH: error_log_limit_unlimited(); - info("SIGNAL: Received %s. Reloading HEALTH configuration...", name); + netdata_log_info("SIGNAL: Received %s. Reloading HEALTH configuration...", name); error_log_limit_reset(); execute_command(CMD_RELOAD_HEALTH, NULL, NULL); break; case NETDATA_SIGNAL_SAVE_DATABASE: error_log_limit_unlimited(); - info("SIGNAL: Received %s. Saving databases...", name); + netdata_log_info("SIGNAL: Received %s. Saving databases...", name); error_log_limit_reset(); execute_command(CMD_SAVE_DATABASE, NULL, NULL); break; case NETDATA_SIGNAL_REOPEN_LOGS: error_log_limit_unlimited(); - info("SIGNAL: Received %s. Reopening all log files...", name); + netdata_log_info("SIGNAL: Received %s. Reopening all log files...", name); error_log_limit_reset(); execute_command(CMD_REOPEN_LOGS, NULL, NULL); break; case NETDATA_SIGNAL_EXIT_CLEANLY: error_log_limit_unlimited(); - info("SIGNAL: Received %s. Cleaning up to exit...", name); + netdata_log_info("SIGNAL: Received %s. Cleaning up to exit...", name); commands_exit(); netdata_cleanup_and_exit(0); exit(0); @@ -240,7 +240,7 @@ void signals_handle(void) { break; default: - info("SIGNAL: Received %s. No signal handler configured. Ignoring it.", name); + netdata_log_info("SIGNAL: Received %s. No signal handler configured. Ignoring it.", name); break; } } |