Skip to content

Commit

Permalink
Move debug messages from DEBUG to WARN
Browse files Browse the repository at this point in the history
Some log messages should be showed as warnings and not as DEBUG
messages.
  • Loading branch information
smukil committed Oct 8, 2019
1 parent d9cfc62 commit d84fd5c
Showing 1 changed file with 12 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -372,36 +372,28 @@ public Message popWithMsgIdHelper(String messageId, String targetShard) {
Long exists = nonQuorumConn.zrank(queueShardName, messageId);
// If we get back a null type, then the element doesn't exist.
if (exists == null) {
if (logger.isDebugEnabled()) {
logger.debug("Cannot find the message with ID {}", messageId);
}
logger.warn("Cannot find the message with ID {}", messageId);
monitor.misses.increment();
return null;
}

String json = quorumConn.hget(messageStoreKey, messageId);
if (json == null) {
if (logger.isDebugEnabled()) {
logger.debug("Cannot get the message payload for {}", messageId);
}
logger.warn("Cannot get the message payload for {}", messageId);
monitor.misses.increment();
return null;
}

long added = quorumConn.zadd(unackShardName, unackScore, messageId, zParams);
if (added == 0) {
if (logger.isDebugEnabled()) {
logger.debug("cannot add {} to the unack shard {}", messageId, unackShardName);
}
logger.warn("cannot add {} to the unack shard {}", messageId, unackShardName);
monitor.misses.increment();
return null;
}

long removed = quorumConn.zrem(queueShardName, messageId);
if (removed == 0) {
if (logger.isDebugEnabled()) {
logger.debug("cannot remove {} from the queue shard ", queueName, messageId);
}
logger.warn("cannot remove {} from the queue shard ", queueName, messageId);
monitor.misses.increment();
return null;
}
Expand Down Expand Up @@ -541,27 +533,21 @@ private List<Message> _pop(String shard, int messageCount,

long added = quorumConn.zadd(unackShardName, unackScore, msgId, zParams);
if(added == 0){
if (logger.isDebugEnabled()) {
logger.debug("cannot add {} to the unack shard {}", msgId, unackShardName);
}
logger.warn("cannot add {} to the unack shard {}", msgId, unackShardName);
monitor.misses.increment();
continue;
}

long removed = quorumConn.zrem(queueShardName, msgId);
if (removed == 0) {
if (logger.isDebugEnabled()) {
logger.debug("cannot remove {} from the queue shard {}", msgId, queueShardName);
}
logger.warn("cannot remove {} from the queue shard {}", msgId, queueShardName);
monitor.misses.increment();
continue;
}

String json = quorumConn.hget(messageStoreKey, msgId);
if (json == null) {
if (logger.isDebugEnabled()) {
logger.debug("Cannot get the message payload for {}", msgId);
}
logger.warn("Cannot get the message payload for {}", msgId);
monitor.misses.increment();
continue;
}
Expand Down Expand Up @@ -810,9 +796,7 @@ public Message get(String messageId) {
return execute("get", messageStoreKey, () -> {
String json = quorumConn.hget(messageStoreKey, messageId);
if (json == null) {
if (logger.isDebugEnabled()) {
logger.debug("Cannot get the message payload " + messageId);
}
logger.warn("Cannot get the message payload " + messageId);
return null;
}

Expand Down Expand Up @@ -906,7 +890,7 @@ public void processUnacks() {
Set<Tuple> unacks = nonQuorumConn.zrangeByScoreWithScores(unackShardName, 0, now, 0, batchSize);

if (unacks.size() > 0) {
logger.info("processUnacks: Adding " + unacks.size() + " messages back to shard of queue: " + unackShardName);
logger.info("processUnacks: Attempting to add " + unacks.size() + " messages back to shard of queue: " + unackShardName);
}

for (Tuple unack : unacks) {
Expand All @@ -926,7 +910,9 @@ public void processUnacks() {
if (added_back > 0 && removed_from_unack > 0) ++num_moved_back;
}

logger.info("processUnacks: Moved back " + num_moved_back + " items. Got rid of " + num_stale + " stale items.");
if (num_moved_back > 0 || num_stale > 0) {
logger.info("processUnacks: Moved back " + num_moved_back + " items. Got rid of " + num_stale + " stale items.");
}
return null;
});

Expand Down

0 comments on commit d84fd5c

Please sign in to comment.