GH-3424: Refactor to use logging methods from LogAccessor

Fixes https://github.com/spring-projects/spring-integration/issues/3424

* Use `LogMessage.format()` for lazily formatting

* Fix some logging statements in `JdbcChannelMessageStore`
This commit is contained in:
trungPa
2021-07-19 22:30:01 +07:00
committed by GitHub
parent 39c3acb042
commit 9c718c37a6
30 changed files with 145 additions and 176 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2007-2019 the original author or authors.
* Copyright 2007-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,6 +21,7 @@ import java.util.Map;
import java.util.Map.Entry;
import java.util.Properties;
import org.springframework.core.log.LogMessage;
import org.springframework.data.redis.connection.RedisConnection;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.BoundSetOperations;
@@ -68,6 +69,7 @@ import org.springframework.util.NumberUtils;
* @author Gary Russell
* @author Mark Fisher
* @author Artem Bilan
* @author Trung Pham
*
* @since 2.2
*/
@@ -464,10 +466,8 @@ public class RedisStoreWritingMessageHandler extends AbstractMessageHandler {
private boolean verifyAllMapValuesOfTypeNumber(Map<?, ?> map) {
for (Object value : map.values()) {
if (!(value instanceof Number)) {
if (this.logger.isWarnEnabled()) {
this.logger.warn("failed to extract payload elements because '" +
value + "' is not of type Number");
}
this.logger.warn(LogMessage.format("failed to extract payload elements"
+ "because '%s' is not of type Number", value));
return false;
}
}