[ISSUE #8096] fix log placeholder

This commit is contained in:
cnScarb
2024-05-07 09:49:43 +08:00
committed by GitHub
parent ac59c03e64
commit a15088cbd3
13 changed files with 27 additions and 29 deletions
@@ -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);
}
}
}
@@ -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(),
@@ -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;
@@ -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();
@@ -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);
@@ -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());
@@ -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());
}
@@ -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() {
@@ -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");
}
@@ -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
@@ -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);
@@ -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;
}
@@ -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);