From b760a2ced20faede982420bf1c239f8479908f05 Mon Sep 17 00:00:00 2001 From: Sara Dickinson Date: Tue, 12 Sep 2017 15:01:02 +0100 Subject: [PATCH] Refine the logging levels to match the errors given when backing off, etc. --- src/context.c | 6 +++--- src/getdns/getdns_extra.h.in | 2 +- src/stub.c | 14 +++++++------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/context.c b/src/context.c index f8bd1493..707016dc 100644 --- a/src/context.c +++ b/src/context.c @@ -754,7 +754,7 @@ upstream_backoff(getdns_upstream *upstream) { upstream->conn_setup_failed = 0; upstream->conn_shutdowns = 0; upstream->conn_backoffs++; - _getdns_upstream_log(upstream, GETDNS_LOG_UPSTREAM_STATS, GETDNS_LOG_DEBUG, + _getdns_upstream_log(upstream, GETDNS_LOG_UPSTREAM_STATS, GETDNS_LOG_NOTICE, "%-40s : !Backing off this upstream - Will retry again at %s", upstream->addr_str, asctime(gmtime(&upstream->conn_retry_time))); @@ -836,13 +836,13 @@ _getdns_upstream_shutdown(getdns_upstream *upstream) (upstream->transport == GETDNS_TRANSPORT_TLS ? "TLS" : "TCP"), (int)upstream->responses_received, (int)upstream->responses_timeouts, _getdns_auth_str(upstream->tls_auth_state), (int)upstream->keepalive_timeout); - _getdns_upstream_log(upstream, GETDNS_LOG_UPSTREAM_STATS, GETDNS_LOG_DEBUG, + _getdns_upstream_log(upstream, GETDNS_LOG_UPSTREAM_STATS, GETDNS_LOG_INFO, "%-40s : Upstream : %s - Resps=%6d, Timeouts =%6d, Best_auth =%7s\n", upstream->addr_str, (upstream->transport == GETDNS_TRANSPORT_TLS ? "TLS" : "TCP"), (int)upstream->total_responses, (int)upstream->total_timeouts, _getdns_auth_str(upstream->best_tls_auth_state)); - _getdns_upstream_log(upstream, GETDNS_LOG_UPSTREAM_STATS, GETDNS_LOG_DEBUG, + _getdns_upstream_log(upstream, GETDNS_LOG_UPSTREAM_STATS, GETDNS_LOG_INFO, "%-40s : Upstream : %s - Conns=%6d, Conn_fails=%6d, Conn_shuts=%7d, Backoffs =%6d\n", upstream->addr_str, (upstream->transport == GETDNS_TRANSPORT_TLS ? "TLS" : "TCP"), diff --git a/src/getdns/getdns_extra.h.in b/src/getdns/getdns_extra.h.in index dbb8eab4..c32a5c14 100644 --- a/src/getdns/getdns_extra.h.in +++ b/src/getdns/getdns_extra.h.in @@ -520,7 +520,7 @@ typedef enum getdns_loglevel_type { #define GETDNS_LOG_CRIT_TEXT "Critical conditions" #define GETDNS_LOG_ERR_TEXT "Error conditions" #define GETDNS_LOG_WARNING_TEXT "Warning conditions" -#define GETDNS_LOG_NOTICE_TEXT "normal, but significant, condition" +#define GETDNS_LOG_NOTICE_TEXT "Normal, but significant, condition" #define GETDNS_LOG_INFO_TEXT "Informational message" #define GETDNS_LOG_DEBUG_TEXT "Debug-level message" diff --git a/src/stub.c b/src/stub.c index 6dd58da2..eac26fcf 100644 --- a/src/stub.c +++ b/src/stub.c @@ -609,7 +609,7 @@ stub_timeout_cb(void *userarg) netreq->fd = -1; netreq->upstream->udp_timeouts++; if (netreq->upstream->udp_timeouts % 100 == 0) - _getdns_upstream_log(netreq->upstream, GETDNS_LOG_UPSTREAM_STATS, GETDNS_LOG_DEBUG, + _getdns_upstream_log(netreq->upstream, GETDNS_LOG_UPSTREAM_STATS, GETDNS_LOG_INFO, "%-40s : Upstream stats: Transport=UDP - Resp=%d,Timeouts=%d\n", netreq->upstream->addr_str, (int)netreq->upstream->udp_responses, (int)netreq->upstream->udp_timeouts); @@ -910,7 +910,7 @@ tls_verify_callback(int preverify_ok, X509_STORE_CTX *ctx) X509_verify_cert_error_string(err)); #endif if (!preverify_ok && !upstream->tls_fallback_ok) - _getdns_upstream_log(upstream, GETDNS_LOG_UPSTREAM_STATS, GETDNS_LOG_DEBUG, + _getdns_upstream_log(upstream, GETDNS_LOG_UPSTREAM_STATS, GETDNS_LOG_ERR, "%-40s : Verify failed : Transport=TLS - *Failure* - (%d) \"%s\"\n", upstream->addr_str, err, X509_verify_cert_error_string(err)); @@ -946,7 +946,7 @@ tls_verify_callback(int preverify_ok, X509_STORE_CTX *ctx) DEBUG_STUB("%s %-35s: FD: %d, WARNING: Proceeding even though pinset validation failed!\n", STUB_DEBUG_SETUP_TLS, __FUNC__, upstream->fd); else - _getdns_upstream_log(upstream, GETDNS_LOG_UPSTREAM_STATS, GETDNS_LOG_DEBUG, + _getdns_upstream_log(upstream, GETDNS_LOG_UPSTREAM_STATS, GETDNS_LOG_ERR, "%-40s : Conn failed : Transport=TLS - *Failure* - Pinset validation failure\n", upstream->addr_str); } else { @@ -1475,7 +1475,7 @@ stub_udp_read_cb(void *userarg) upstream->udp_responses++; if (upstream->udp_responses == 1 || upstream->udp_responses % 100 == 0) - _getdns_upstream_log(upstream, GETDNS_LOG_UPSTREAM_STATS, GETDNS_LOG_DEBUG, + _getdns_upstream_log(upstream, GETDNS_LOG_UPSTREAM_STATS, GETDNS_LOG_INFO, "%-40s : Upstream stats: Transport=UDP - Resp=%d,Timeouts=%d\n", upstream->addr_str, (int)upstream->udp_responses, (int)upstream->udp_timeouts); @@ -1900,7 +1900,7 @@ upstream_select_stateful(getdns_network_req *netreq, getdns_transport_list_t tra upstreams->upstreams[i].conn_retry_time < now) { upstreams->upstreams[i].conn_state = GETDNS_CONN_CLOSED; upstreams->upstreams[i].conn_backoff_interval = 1; - _getdns_upstream_log(upstream, GETDNS_LOG_UPSTREAM_STATS, GETDNS_LOG_DEBUG, + _getdns_upstream_log(upstream, GETDNS_LOG_UPSTREAM_STATS, GETDNS_LOG_NOTICE, "%-40s : Re-instating upstream\n", upstreams->upstreams[i].addr_str); } @@ -1958,7 +1958,7 @@ upstream_select_stateful(getdns_network_req *netreq, getdns_transport_list_t tra } while (i != upstreams->current_stateful); upstream->conn_state = GETDNS_CONN_CLOSED; upstream->conn_backoff_interval = 1; - _getdns_upstream_log(upstream, GETDNS_LOG_UPSTREAM_STATS, GETDNS_LOG_DEBUG, + _getdns_upstream_log(upstream, GETDNS_LOG_UPSTREAM_STATS, GETDNS_LOG_NOTICE, "%-40s : No valid upstreams... promoting backed-off upstream %s for re-try...\n", upstreams->upstreams[i].addr_str); return upstream; @@ -2142,7 +2142,7 @@ upstream_find_for_netreq(getdns_network_req *netreq) } /* Handle better, will give generic error*/ DEBUG_STUB("%s %-35s: MSG: %p No valid upstream! \n", STUB_DEBUG_SCHEDULE, __FUNC__, (void*)netreq); - _getdns_context_log(netreq->owner->context, GETDNS_LOG_UPSTREAM_STATS, GETDNS_LOG_DEBUG, + _getdns_context_log(netreq->owner->context, GETDNS_LOG_UPSTREAM_STATS, GETDNS_LOG_ERR, "*FAILURE* no valid transports or upstreams available!\n"); return -1; }