From dc88617c99f04a89f7b7aa0f1f1e4d455d97faa3 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Thu, 28 Aug 2014 01:40:36 +0000 Subject: [PATCH] Lower log level of limit increases and releases In some configurations where many limits are used, the limit increases and releases were generating a lot of noise and making it harder to see when limits were exceeded, which was at the same log level. --- src/mod/applications/mod_db/mod_db.c | 4 ++-- src/mod/applications/mod_hash/mod_hash.c | 10 +++++----- src/switch_limit.c | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/mod/applications/mod_db/mod_db.c b/src/mod/applications/mod_db/mod_db.c index 58a5a25616..d0e9dd8931 100644 --- a/src/mod/applications/mod_db/mod_db.c +++ b/src/mod/applications/mod_db/mod_db.c @@ -188,9 +188,9 @@ SWITCH_LIMIT_INCR(limit_incr_db) got = atoi(gotstr); if (max < 0) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Usage for %s_%s is now %d\n", realm, resource, got + 1); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Usage for %s_%s is now %d\n", realm, resource, got + 1); } else { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Usage for %s_%s is now %d/%d\n", realm, resource, got + 1, max); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Usage for %s_%s is now %d/%d\n", realm, resource, got + 1, max); } if (max >= 0 && got + 1 > max) { diff --git a/src/mod/applications/mod_hash/mod_hash.c b/src/mod/applications/mod_hash/mod_hash.c index d151bd7c9d..b24cab6bc7 100644 --- a/src/mod/applications/mod_hash/mod_hash.c +++ b/src/mod/applications/mod_hash/mod_hash.c @@ -197,11 +197,11 @@ SWITCH_LIMIT_INCR(limit_incr_hash) switch_core_hash_insert(pvt->hash, hashkey, item); if (max == -1) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Usage for %s is now %d\n", hashkey, item->total_usage + remote_usage.total_usage); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Usage for %s is now %d\n", hashkey, item->total_usage + remote_usage.total_usage); } else if (interval == 0) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Usage for %s is now %d/%d\n", hashkey, item->total_usage + remote_usage.total_usage, max); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Usage for %s is now %d/%d\n", hashkey, item->total_usage + remote_usage.total_usage, max); } else { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Usage for %s is now %d/%d for the last %d seconds\n", hashkey, + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Usage for %s is now %d/%d for the last %d seconds\n", hashkey, item->rate_usage, max, interval); } @@ -301,7 +301,7 @@ SWITCH_LIMIT_RELEASE(limit_release_hash) item = (limit_hash_item_t *) val; item->total_usage--; - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Usage for %s is now %d\n", (const char *) key, item->total_usage); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Usage for %s is now %d\n", (const char *) key, item->total_usage); if (item->total_usage == 0 && item->rate_usage == 0) { /* Noone is using this item anymore */ @@ -316,7 +316,7 @@ SWITCH_LIMIT_RELEASE(limit_release_hash) if ((item = (limit_hash_item_t *) switch_core_hash_find(pvt->hash, hashkey))) { item->total_usage--; - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Usage for %s is now %d\n", (const char *) hashkey, item->total_usage); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Usage for %s is now %d\n", (const char *) hashkey, item->total_usage); switch_core_hash_delete(pvt->hash, hashkey); diff --git a/src/switch_limit.c b/src/switch_limit.c index e6e421b091..e703432252 100644 --- a/src/switch_limit.c +++ b/src/switch_limit.c @@ -123,7 +123,7 @@ SWITCH_DECLARE(switch_status_t) switch_limit_incr(const char *backend, switch_co switch_goto_status(SWITCH_STATUS_GENERR, end); } - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "incr called: %s_%s max:%d, interval:%d\n", + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "incr called: %s_%s max:%d, interval:%d\n", realm, resource, max, interval); if ((status = limit->incr(session, realm, resource, max, interval)) == SWITCH_STATUS_SUCCESS) {