This is an automated email from the ASF dual-hosted git repository.

jinrongtong pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/rocketmq.git


The following commit(s) were added to refs/heads/develop by this push:
     new a15088cbd3 [ISSUE #8096] fix log placeholder
a15088cbd3 is described below

commit a15088cbd33d665a457472e0f513507dc89d8a8d
Author: cnScarb <jjhfe...@163.com>
AuthorDate: Tue May 7 09:49:43 2024 +0800

    [ISSUE #8096] fix log placeholder
---
 .../org/apache/rocketmq/client/impl/ClientRemotingProcessor.java  | 4 ++--
 .../java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java     | 4 ++--
 .../client/impl/consumer/ConsumeMessageConcurrentlyService.java   | 8 ++++----
 .../client/impl/consumer/ConsumeMessageOrderlyService.java        | 8 ++++----
 .../impl/consumer/ConsumeMessagePopConcurrentlyService.java       | 4 ++--
 .../client/impl/consumer/ConsumeMessagePopOrderlyService.java     | 4 ++--
 .../rocketmq/client/impl/producer/DefaultMQProducerImpl.java      | 8 ++++----
 .../java/org/apache/rocketmq/common/stats/MomentStatsItem.java    | 4 ++--
 .../org/apache/rocketmq/controller/impl/DLedgerController.java    | 2 +-
 .../java/org/apache/rocketmq/test/client/rmq/RMQPopConsumer.java  | 2 +-
 .../main/java/org/apache/rocketmq/test/util/MQAdminTestUtils.java | 3 +--
 test/src/test/java/org/apache/rocketmq/test/base/BaseConf.java    | 3 +--
 .../apache/rocketmq/test/client/consumer/pop/PopSubCheckIT.java   | 2 +-
 13 files changed, 27 insertions(+), 29 deletions(-)

diff --git 
a/client/src/main/java/org/apache/rocketmq/client/impl/ClientRemotingProcessor.java
 
b/client/src/main/java/org/apache/rocketmq/client/impl/ClientRemotingProcessor.java
index 2f18c610c1..e46c651f92 100644
--- 
a/client/src/main/java/org/apache/rocketmq/client/impl/ClientRemotingProcessor.java
+++ 
b/client/src/main/java/org/apache/rocketmq/client/impl/ClientRemotingProcessor.java
@@ -288,8 +288,8 @@ public class ClientRemotingProcessor implements 
NettyRequestProcessor {
             }
         } else {
             String bornHost = replyMsg.getBornHostString();
-            logger.warn(String.format("receive reply message, but not matched 
any request, CorrelationId: %s , reply from host: %s",
-                correlationId, bornHost));
+            logger.warn("receive reply message, but not matched any request, 
CorrelationId: {} , reply from host: {}",
+                correlationId, bornHost);
         }
     }
 }
diff --git 
a/client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java 
b/client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java
index 0c58affa34..9b15279cb6 100644
--- a/client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java
+++ b/client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java
@@ -1168,7 +1168,7 @@ public class MQClientAPIImpl implements 
NameServerUpdateCallback {
                             index = sortMap.get(queueIdKey).indexOf(offset);
                             msgQueueOffset = 
msgOffsetInfo.get(queueIdKey).get(index);
                             if (msgQueueOffset != offset) {
-                                log.warn("Queue offset[%d] of msg is strange, 
not equal to the stored in msg, %s",
+                                log.warn("Queue offset[{}] of msg is strange, 
not equal to the stored in msg, {}",
                                     msgQueueOffset, messageExt);
                             }
                             
messageExt.getProperties().put(MessageConst.PROPERTY_POP_CK,
@@ -1181,7 +1181,7 @@ public class MQClientAPIImpl implements 
NameServerUpdateCallback {
                             index = 
sortMap.get(queueIdKey).indexOf(messageExt.getQueueOffset());
                             msgQueueOffset = 
msgOffsetInfo.get(queueIdKey).get(index);
                             if (msgQueueOffset != messageExt.getQueueOffset()) 
{
-                                log.warn("Queue offset[%d] of msg is strange, 
not equal to the stored in msg, %s", msgQueueOffset, messageExt);
+                                log.warn("Queue offset[{}] of msg is strange, 
not equal to the stored in msg, {}", msgQueueOffset, messageExt);
                             }
                             
messageExt.getProperties().put(MessageConst.PROPERTY_POP_CK,
                                 
ExtraInfoUtil.buildExtraInfo(startOffsetInfo.get(queueIdKey), 
responseHeader.getPopTime(), responseHeader.getInvisibleTime(),
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 ea6c8072b5..b151fefbbb 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
@@ -169,11 +169,11 @@ public class ConsumeMessageConcurrentlyService implements 
ConsumeMessageService
             result.setConsumeResult(CMResult.CR_THROW_EXCEPTION);
             result.setRemark(UtilAll.exceptionSimpleDesc(e));
 
-            log.warn(String.format("consumeMessageDirectly exception: %s 
Group: %s Msgs: %s MQ: %s",
+            log.warn("consumeMessageDirectly exception: {} Group: {} Msgs: {} 
MQ: {}",
                 UtilAll.exceptionSimpleDesc(e),
                 ConsumeMessageConcurrentlyService.this.consumerGroup,
                 msgs,
-                mq), e);
+                mq, e);
         }
 
         result.setSpentTimeMills(System.currentTimeMillis() - beginTime);
@@ -410,11 +410,11 @@ public class ConsumeMessageConcurrentlyService implements 
ConsumeMessageService
                 }
                 status = 
listener.consumeMessage(Collections.unmodifiableList(msgs), context);
             } catch (Throwable e) {
-                log.warn(String.format("consumeMessage exception: %s Group: %s 
Msgs: %s MQ: %s",
+                log.warn("consumeMessage exception: {} Group: {} Msgs: {} MQ: 
{}",
                     UtilAll.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 cab4fe5d69..36d686048c 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
@@ -181,11 +181,11 @@ public class ConsumeMessageOrderlyService implements 
ConsumeMessageService {
             result.setConsumeResult(CMResult.CR_THROW_EXCEPTION);
             result.setRemark(UtilAll.exceptionSimpleDesc(e));
 
-            log.warn(String.format("consumeMessageDirectly exception: %s 
Group: %s Msgs: %s MQ: %s",
+            log.warn("consumeMessageDirectly exception: {} Group: {} Msgs: {} 
MQ: {}",
                 UtilAll.exceptionSimpleDesc(e),
                 ConsumeMessageOrderlyService.this.consumerGroup,
                 msgs,
-                mq), e);
+                mq, e);
         }
 
         result.setAutoCommit(context.isAutoCommit());
@@ -497,11 +497,11 @@ public class ConsumeMessageOrderlyService implements 
ConsumeMessageService {
 
                                 status = 
messageListener.consumeMessage(Collections.unmodifiableList(msgs), context);
                             } catch (Throwable e) {
-                                log.warn(String.format("consumeMessage 
exception: %s Group: %s Msgs: %s MQ: %s",
+                                log.warn("consumeMessage exception: {} Group: 
{} Msgs: {} MQ: {}",
                                     UtilAll.exceptionSimpleDesc(e),
                                     
ConsumeMessageOrderlyService.this.consumerGroup,
                                     msgs,
-                                    messageQueue), e);
+                                    messageQueue, e);
                                 hasException = true;
                             } finally {
                                 
this.processQueue.getConsumeLock().readLock().unlock();
diff --git 
a/client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessagePopConcurrentlyService.java
 
b/client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessagePopConcurrentlyService.java
index a61454f595..3713d1aba4 100644
--- 
a/client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessagePopConcurrentlyService.java
+++ 
b/client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessagePopConcurrentlyService.java
@@ -153,11 +153,11 @@ public class ConsumeMessagePopConcurrentlyService 
implements ConsumeMessageServi
             result.setConsumeResult(CMResult.CR_THROW_EXCEPTION);
             result.setRemark(UtilAll.exceptionSimpleDesc(e));
 
-            log.warn(String.format("consumeMessageDirectly exception: %s 
Group: %s Msgs: %s MQ: %s",
+            log.warn("consumeMessageDirectly exception: {} Group: {} Msgs: {} 
MQ: {}",
                 UtilAll.exceptionSimpleDesc(e),
                 ConsumeMessagePopConcurrentlyService.this.consumerGroup,
                 msgs,
-                mq), e);
+                mq, e);
         }
 
         result.setSpentTimeMills(System.currentTimeMillis() - beginTime);
diff --git 
a/client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessagePopOrderlyService.java
 
b/client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessagePopOrderlyService.java
index ae6adfea5d..4eab1ccf66 100644
--- 
a/client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessagePopOrderlyService.java
+++ 
b/client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessagePopOrderlyService.java
@@ -175,11 +175,11 @@ public class ConsumeMessagePopOrderlyService implements 
ConsumeMessageService {
             result.setConsumeResult(CMResult.CR_THROW_EXCEPTION);
             result.setRemark(UtilAll.exceptionSimpleDesc(e));
 
-            log.warn(String.format("consumeMessageDirectly exception: %s 
Group: %s Msgs: %s MQ: %s",
+            log.warn("consumeMessageDirectly exception: {} Group: {} Msgs: {} 
MQ: {}",
                 UtilAll.exceptionSimpleDesc(e),
                 ConsumeMessagePopOrderlyService.this.consumerGroup,
                 msgs,
-                mq), e);
+                mq, e);
         }
 
         result.setAutoCommit(context.isAutoCommit());
diff --git 
a/client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java
 
b/client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java
index d171411d02..5b7bd2dc9d 100644
--- 
a/client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java
+++ 
b/client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java
@@ -762,7 +762,7 @@ public class DefaultMQProducerImpl implements 
MQProducerInner {
                     } catch (MQClientException e) {
                         endTimestamp = System.currentTimeMillis();
                         this.updateFaultItem(mq.getBrokerName(), endTimestamp 
- beginTimestampPrev, false, true);
-                        log.warn("sendKernelImpl exception, resend at once, 
InvokeID: %s, RT: %sms, Broker: %s", invokeID, endTimestamp - 
beginTimestampPrev, mq, e);
+                        log.warn("sendKernelImpl exception, resend at once, 
InvokeID: {}, RT: {}ms, Broker: {}", invokeID, endTimestamp - 
beginTimestampPrev, mq, e);
                         log.warn(msg.toString());
                         exception = e;
                         continue;
@@ -775,7 +775,7 @@ public class DefaultMQProducerImpl implements 
MQProducerInner {
                             // Otherwise, isolate this broker.
                             this.updateFaultItem(mq.getBrokerName(), 
endTimestamp - beginTimestampPrev, true, true);
                         }
-                        log.warn("sendKernelImpl exception, resend at once, 
InvokeID: %s, RT: %sms, Broker: %s", invokeID, endTimestamp - 
beginTimestampPrev, mq, e);
+                        log.warn("sendKernelImpl exception, resend at once, 
InvokeID: {}, RT: {}ms, Broker: {}", invokeID, endTimestamp - 
beginTimestampPrev, mq, e);
                         if (log.isDebugEnabled()) {
                             log.debug(msg.toString());
                         }
@@ -784,7 +784,7 @@ public class DefaultMQProducerImpl implements 
MQProducerInner {
                     } catch (MQBrokerException e) {
                         endTimestamp = System.currentTimeMillis();
                         this.updateFaultItem(mq.getBrokerName(), endTimestamp 
- beginTimestampPrev, true, false);
-                        log.warn("sendKernelImpl exception, resend at once, 
InvokeID: %s, RT: %sms, Broker: %s", invokeID, endTimestamp - 
beginTimestampPrev, mq, e);
+                        log.warn("sendKernelImpl exception, resend at once, 
InvokeID: {}, RT: {}ms, Broker: {}", invokeID, endTimestamp - 
beginTimestampPrev, mq, e);
                         if (log.isDebugEnabled()) {
                             log.debug(msg.toString());
                         }
@@ -801,7 +801,7 @@ public class DefaultMQProducerImpl implements 
MQProducerInner {
                     } catch (InterruptedException e) {
                         endTimestamp = System.currentTimeMillis();
                         this.updateFaultItem(mq.getBrokerName(), endTimestamp 
- beginTimestampPrev, false, true);
-                        log.warn("sendKernelImpl exception, throw exception, 
InvokeID: %s, RT: %sms, Broker: %s", invokeID, endTimestamp - 
beginTimestampPrev, mq, e);
+                        log.warn("sendKernelImpl exception, throw exception, 
InvokeID: {}, RT: {}ms, Broker: {}", invokeID, endTimestamp - 
beginTimestampPrev, mq, e);
                         if (log.isDebugEnabled()) {
                             log.debug(msg.toString());
                         }
diff --git 
a/common/src/main/java/org/apache/rocketmq/common/stats/MomentStatsItem.java 
b/common/src/main/java/org/apache/rocketmq/common/stats/MomentStatsItem.java
index d38281bf83..71c796b283 100644
--- a/common/src/main/java/org/apache/rocketmq/common/stats/MomentStatsItem.java
+++ b/common/src/main/java/org/apache/rocketmq/common/stats/MomentStatsItem.java
@@ -55,10 +55,10 @@ public class MomentStatsItem {
     }
 
     public void printAtMinutes() {
-        log.info(String.format("[%s] [%s] Stats Every 5 Minutes, Value: %d",
+        log.info("[{}] [{}] Stats Every 5 Minutes, Value: {}",
             this.statsName,
             this.statsKey,
-            this.value.get()));
+            this.value.get());
     }
 
     public AtomicLong getValue() {
diff --git 
a/controller/src/main/java/org/apache/rocketmq/controller/impl/DLedgerController.java
 
b/controller/src/main/java/org/apache/rocketmq/controller/impl/DLedgerController.java
index a032b7b621..be487849ce 100644
--- 
a/controller/src/main/java/org/apache/rocketmq/controller/impl/DLedgerController.java
+++ 
b/controller/src/main/java/org/apache/rocketmq/controller/impl/DLedgerController.java
@@ -569,7 +569,7 @@ public class DLedgerController implements Controller {
                                 break;
                             }
                             tryTimes++;
-                            log.error(String.format("Controller leader append 
initial log failed, try %d times", tryTimes));
+                            log.error("Controller leader append initial log 
failed, try {} times", tryTimes);
                             if (tryTimes % 3 == 0) {
                                 log.warn("Controller leader append initial log 
failed too many times, please wait a while");
                             }
diff --git 
a/test/src/main/java/org/apache/rocketmq/test/client/rmq/RMQPopConsumer.java 
b/test/src/main/java/org/apache/rocketmq/test/client/rmq/RMQPopConsumer.java
index a7046bca7d..67a781aacc 100644
--- a/test/src/main/java/org/apache/rocketmq/test/client/rmq/RMQPopConsumer.java
+++ b/test/src/main/java/org/apache/rocketmq/test/client/rmq/RMQPopConsumer.java
@@ -58,7 +58,7 @@ public class RMQPopConsumer extends RMQNormalConsumer {
     @Override
     public void start() {
         client = ConsumerFactory.getRMQPopClient();
-        log.info(String.format("consumer[%s] started!", consumerGroup));
+        log.info("consumer[{}] started!", consumerGroup);
     }
 
     @Override
diff --git 
a/test/src/main/java/org/apache/rocketmq/test/util/MQAdminTestUtils.java 
b/test/src/main/java/org/apache/rocketmq/test/util/MQAdminTestUtils.java
index d3d5de9e27..47a8db3c9a 100644
--- a/test/src/main/java/org/apache/rocketmq/test/util/MQAdminTestUtils.java
+++ b/test/src/main/java/org/apache/rocketmq/test/util/MQAdminTestUtils.java
@@ -117,8 +117,7 @@ public class MQAdminTestUtils {
             for (String addr : masterSet) {
                 try {
                     mqAdminExt.createAndUpdateSubscriptionGroupConfig(addr, 
config);
-                    log.info(String.format("create subscription group %s to %s 
success.\n", consumerId,
-                            addr));
+                    log.info("create subscription group {} to {} success.", 
consumerId, addr);
                 } catch (Exception e) {
                     e.printStackTrace();
                     Thread.sleep(1000 * 1);
diff --git a/test/src/test/java/org/apache/rocketmq/test/base/BaseConf.java 
b/test/src/test/java/org/apache/rocketmq/test/base/BaseConf.java
index d271391950..b64cda3342 100644
--- a/test/src/test/java/org/apache/rocketmq/test/base/BaseConf.java
+++ b/test/src/test/java/org/apache/rocketmq/test/base/BaseConf.java
@@ -287,8 +287,7 @@ public class BaseConf {
             consumer.setDebug();
         }
         mqClients.add(consumer);
-        log.info(String.format("consumer[%s] 
start,topic[%s],subExpression[%s]", consumerGroup,
-                topic, subExpression));
+        log.info("consumer[{}] start,topic[{}],subExpression[{}]", 
consumerGroup, topic, subExpression);
         return consumer;
     }
 
diff --git 
a/test/src/test/java/org/apache/rocketmq/test/client/consumer/pop/PopSubCheckIT.java
 
b/test/src/test/java/org/apache/rocketmq/test/client/consumer/pop/PopSubCheckIT.java
index e2a657f434..3034876846 100644
--- 
a/test/src/test/java/org/apache/rocketmq/test/client/consumer/pop/PopSubCheckIT.java
+++ 
b/test/src/test/java/org/apache/rocketmq/test/client/consumer/pop/PopSubCheckIT.java
@@ -64,7 +64,7 @@ public class PopSubCheckIT extends BaseConf {
     @Test
     public void testNormalPopAck() throws Exception {
         String topic = initTopic();
-        log.info(String.format("use topic: %s; group: %s !", topic, group));
+        log.info("use topic: {}; group: {} !", topic, group);
 
         RMQNormalProducer producer = getProducer(NAMESRV_ADDR, topic);
         
producer.getProducer().setCompressMsgBodyOverHowmuch(Integer.MAX_VALUE);

Reply via email to