From bc73c32c905cf2a6d72edb4565cc0da1fee84cbc Mon Sep 17 00:00:00 2001 From: sunbufu Date: Sat, 3 Jul 2021 20:46:06 +0800 Subject: [PATCH] use String.format() in warn log. --- .../impl/consumer/ConsumeMessageConcurrentlyService.java | 5 ++--- .../client/impl/consumer/ConsumeMessageOrderlyService.java | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java b/client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java index e7b11a0c..925e5258 100644 --- a/client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java +++ b/client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java @@ -411,12 +411,11 @@ public class ConsumeMessageConcurrentlyService implements ConsumeMessageService } status = listener.consumeMessage(Collections.unmodifiableList(msgs), context); } catch (Throwable e) { - log.warn("consumeMessage exception: {} Group: {} Msgs: {} MQ: {}", + log.warn(String.format("consumeMessage exception: %s Group: %s Msgs: %s MQ: %s", RemotingHelper.exceptionSimpleDesc(e), ConsumeMessageConcurrentlyService.this.consumerGroup, msgs, - messageQueue, - e); + messageQueue), e); hasException = true; } long consumeRT = System.currentTimeMillis() - beginTimestamp; diff --git a/client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java b/client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java index 5bd856e8..8d92b571 100644 --- a/client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java +++ b/client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageOrderlyService.java @@ -487,12 +487,11 @@ public class ConsumeMessageOrderlyService implements ConsumeMessageService { status = messageListener.consumeMessage(Collections.unmodifiableList(msgs), context); } catch (Throwable e) { - log.warn("consumeMessage exception: {} Group: {} Msgs: {} MQ: {}", + log.warn(String.format("consumeMessage exception: %s Group: %s Msgs: %s MQ: %s", RemotingHelper.exceptionSimpleDesc(e), ConsumeMessageOrderlyService.this.consumerGroup, msgs, - messageQueue, - e); + messageQueue), e); hasException = true; } finally { this.processQueue.getConsumeLock().unlock(); -- GitLab