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.
This commit is contained in:
Travis Cross 2014-08-28 01:40:36 +00:00
parent 5a209a9680
commit dc88617c99
3 changed files with 8 additions and 8 deletions

View File

@ -188,9 +188,9 @@ SWITCH_LIMIT_INCR(limit_incr_db)
got = atoi(gotstr); got = atoi(gotstr);
if (max < 0) { 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 { } 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) { if (max >= 0 && got + 1 > max) {

View File

@ -197,11 +197,11 @@ SWITCH_LIMIT_INCR(limit_incr_hash)
switch_core_hash_insert(pvt->hash, hashkey, item); switch_core_hash_insert(pvt->hash, hashkey, item);
if (max == -1) { 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) { } 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 { } 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); item->rate_usage, max, interval);
} }
@ -301,7 +301,7 @@ SWITCH_LIMIT_RELEASE(limit_release_hash)
item = (limit_hash_item_t *) val; item = (limit_hash_item_t *) val;
item->total_usage--; 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) { if (item->total_usage == 0 && item->rate_usage == 0) {
/* Noone is using this item anymore */ /* 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))) { if ((item = (limit_hash_item_t *) switch_core_hash_find(pvt->hash, hashkey))) {
item->total_usage--; 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); switch_core_hash_delete(pvt->hash, hashkey);

View File

@ -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_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); realm, resource, max, interval);
if ((status = limit->incr(session, realm, resource, max, interval)) == SWITCH_STATUS_SUCCESS) { if ((status = limit->incr(session, realm, resource, max, interval)) == SWITCH_STATUS_SUCCESS) {