Skip to content

Commit

Permalink
[ISSUE apache#8096] fix log placeholder
Browse files Browse the repository at this point in the history
  • Loading branch information
HScarb authored May 7, 2024
1 parent ac59c03 commit a15088c
Show file tree
Hide file tree
Showing 13 changed files with 27 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,8 @@ private void processReplyMessage(MessageExt replyMsg) {
}
} 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);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1168,7 +1168,7 @@ private PopResult processPopResponse(final String brokerName, final RemotingComm
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,
Expand All @@ -1181,7 +1181,7 @@ private PopResult processPopResponse(final String brokerName, final RemotingComm
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(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,11 @@ public ConsumeMessageDirectlyResult consumeMessageDirectly(MessageExt msg, Strin
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);
Expand Down Expand Up @@ -410,11 +410,11 @@ public void run() {
}
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,11 @@ public ConsumeMessageDirectlyResult consumeMessageDirectly(MessageExt msg, Strin
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());
Expand Down Expand Up @@ -497,11 +497,11 @@ public void run() {

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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,11 @@ public ConsumeMessageDirectlyResult consumeMessageDirectly(MessageExt msg, Strin
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,11 @@ public ConsumeMessageDirectlyResult consumeMessageDirectly(MessageExt msg, Strin
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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,7 @@ private SendResult sendDefaultImpl(
} 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;
Expand All @@ -775,7 +775,7 @@ private SendResult sendDefaultImpl(
// 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());
}
Expand All @@ -784,7 +784,7 @@ private SendResult sendDefaultImpl(
} 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());
}
Expand All @@ -801,7 +801,7 @@ private SendResult sendDefaultImpl(
} 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());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ public void run() {
}

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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ public void handle(long term, MemberState.Role role) {
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");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public RMQPopConsumer(String nsAddr, String topic, String subExpression,
@Override
public void start() {
client = ConsumerFactory.getRMQPopClient();
log.info(String.format("consumer[%s] started!", consumerGroup));
log.info("consumer[{}] started!", consumerGroup);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,7 @@ public static boolean createSub(String nameSrvAddr, String clusterName, String c
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,7 @@ public static RMQNormalConsumer getConsumer(String nsAddr, String consumerGroup,
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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public void tearDown() {
@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);
Expand Down

0 comments on commit a15088c

Please sign in to comment.