Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Polish placeholders in logging content to slf4j convention #1342

Merged
merged 2 commits into from
Mar 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ private static void initializeApiChangeObserverSpi() {
List<ApiDefinitionChangeObserver> listeners = SpiLoader.loadInstanceList(ApiDefinitionChangeObserver.class);
for (ApiDefinitionChangeObserver e : listeners) {
API_CHANGE_OBSERVERS.put(e.getClass().getCanonicalName(), e);
RecordLog.info("[GatewayApiDefinitionManager] ApiDefinitionChangeObserver added: {0}",
e.getClass().getCanonicalName());
RecordLog.info("[GatewayApiDefinitionManager] ApiDefinitionChangeObserver added: "
+ e.getClass().getCanonicalName());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public CommandResponse<String> handle(CommandRequest request) {
return CommandResponse.ofFailure(e, "decode gateway API definition data error");
}

RecordLog.info("[API Server] Receiving data change (type: gateway API definition): {0}", data);
RecordLog.info("[API Server] Receiving data change (type: gateway API definition): {}", data);

String result = SUCCESS_MSG;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public void postHandle(HttpServletRequest request, HttpServletResponse response,
protected void setEntryInRequest(HttpServletRequest request, String name, Entry entry) {
Object attrVal = request.getAttribute(name);
if (attrVal != null) {
RecordLog.warn("[{}] The attribute key '{0}' already exists in request, please set `requestAttributeName`",
RecordLog.warn("[{}] The attribute key '{}' already exists in request, please set `requestAttributeName`",
getClass().getSimpleName(), name);
} else {
request.setAttribute(name, entry);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public void writeTo(ClusterRequest request, ByteBuf target) {
EntityWriter<Object, ByteBuf> requestDataWriter = RequestDataWriterRegistry.getWriter(type);

if (requestDataWriter == null) {
RecordLog.warn("[DefaultRequestEntityWriter] Cannot find matching request writer for type <{0}>,"
RecordLog.warn("[DefaultRequestEntityWriter] Cannot find matching request writer for type <{}>,"
+ " dropping the request", type);
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public ClusterResponse decode(ByteBuf source) {

EntityDecoder<ByteBuf, ?> decoder = ResponseDataDecodeRegistry.getDecoder(type);
if (decoder == null) {
RecordLog.warn("Unknown type of response data decoder: {0}", type);
RecordLog.warn("Unknown type of response data decoder: {}", type);
return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@ private void fireClientPing(ChannelHandlerContext ctx) {
private void handlePingResponse(ChannelHandlerContext ctx, ClusterResponse response) {
if (response.getStatus() == ClusterConstants.RESPONSE_STATUS_OK) {
int count = (int) response.getData();
RecordLog.info("[TokenClientHandler] Client ping OK (target server: {0}, connected count: {1})",
RecordLog.info("[TokenClientHandler] Client ping OK (target server: {}, connected count: {})",
getRemoteAddress(ctx), count);
} else {
RecordLog.warn("[TokenClientHandler] Client ping failed (target server: {0})", getRemoteAddress(ctx));
RecordLog.warn("[TokenClientHandler] Client ping failed (target server: {})", getRemoteAddress(ctx));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public static void register2Property(String namespace) {
}
synchronized (UPDATE_LOCK) {
RecordLog.info("[ClusterFlowRuleManager] Registering new property to cluster flow rule manager"
+ " for namespace <{0}>", namespace);
+ " for namespace <{}>", namespace);
registerPropertyInternal(namespace, property);
}
}
Expand Down Expand Up @@ -180,7 +180,7 @@ public static void removeProperty(String namespace) {
PROPERTY_MAP.remove(namespace);
}
RecordLog.info("[ClusterFlowRuleManager] Removing property from cluster flow rule manager"
+ " for namespace <{0}>", namespace);
+ " for namespace <{}>", namespace);
}
}

Expand Down Expand Up @@ -380,14 +380,14 @@ public FlowRulePropertyListener(String namespace) {
@Override
public synchronized void configUpdate(List<FlowRule> conf) {
applyClusterFlowRule(conf, namespace);
RecordLog.info("[ClusterFlowRuleManager] Cluster flow rules received for namespace <{0}>: {1}",
RecordLog.info("[ClusterFlowRuleManager] Cluster flow rules received for namespace <{}>: {}",
namespace, FLOW_RULES);
}

@Override
public synchronized void configLoad(List<FlowRule> conf) {
applyClusterFlowRule(conf, namespace);
RecordLog.info("[ClusterFlowRuleManager] Cluster flow rules loaded for namespace <{0}>: {1}",
RecordLog.info("[ClusterFlowRuleManager] Cluster flow rules loaded for namespace <{}>: {}",
namespace, FLOW_RULES);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public static void register2Property(String namespace) {
}
synchronized (UPDATE_LOCK) {
RecordLog.info("[ClusterParamFlowRuleManager] Registering new property to cluster param rule manager"
+ " for namespace <{0}>", namespace);
+ " for namespace <{}>", namespace);
registerPropertyInternal(namespace, property);
}
}
Expand Down Expand Up @@ -167,7 +167,7 @@ public static void removeProperty(String namespace) {
PROPERTY_MAP.remove(namespace);
}
RecordLog.info("[ClusterParamFlowRuleManager] Removing property from cluster flow rule manager"
+ " for namespace <{0}>", namespace);
+ " for namespace <{}>", namespace);
}
}

Expand Down Expand Up @@ -303,14 +303,14 @@ public ParamRulePropertyListener(String namespace) {
@Override
public void configLoad(List<ParamFlowRule> conf) {
applyClusterParamRules(conf, namespace);
RecordLog.info("[ClusterParamFlowRuleManager] Cluster parameter rules loaded for namespace <{0}>: {1}",
RecordLog.info("[ClusterParamFlowRuleManager] Cluster parameter rules loaded for namespace <{}>: {}",
namespace, PARAM_RULES);
}

@Override
public void configUpdate(List<ParamFlowRule> conf) {
applyClusterParamRules(conf, namespace);
RecordLog.info("[ClusterParamFlowRuleManager] Cluster parameter rules received for namespace <{0}>: {1}",
RecordLog.info("[ClusterParamFlowRuleManager] Cluster parameter rules received for namespace <{}>: {}",
namespace, PARAM_RULES);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public ClusterRequest decode(ByteBuf source) {

EntityDecoder<ByteBuf, ?> dataDecoder = RequestDataDecodeRegistry.getDecoder(type);
if (dataDecoder == null) {
RecordLog.warn("Unknown type of request data decoder: {0}", type);
RecordLog.warn("Unknown type of request data decoder: {}", type);
return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public void writeTo(ClusterResponse response, ByteBuf out) {

if (responseDataWriter == null) {
writeHead(response.setStatus(ClusterConstants.RESPONSE_STATUS_BAD), out);
RecordLog.warn("[NettyResponseEncoder] Cannot find matching writer for type <{0}>", response.getType());
RecordLog.warn("[NettyResponseEncoder] Cannot find matching writer for type <{}>", response.getType());
return;
}
writeHead(response, out);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public CommandResponse<String> handle(CommandRequest request) {
}
try {
data = URLDecoder.decode(data, "UTF-8");
RecordLog.info("[ModifyClusterFlowRulesCommandHandler] Receiving cluster flow rules for namespace <{0}>: {1}", namespace, data);
RecordLog.info("[ModifyClusterFlowRulesCommandHandler] Receiving cluster flow rules for namespace <{}>: {}", namespace, data);

List<FlowRule> flowRules = JSONArray.parseArray(data, FlowRule.class);
ClusterFlowRuleManager.loadRules(namespace, flowRules);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public CommandResponse<String> handle(CommandRequest request) {
}
try {
data = URLDecoder.decode(data, "UTF-8");
RecordLog.info("[ModifyClusterParamFlowRulesCommandHandler] Receiving cluster param rules for namespace <{0}>: {1}", namespace, data);
RecordLog.info("Receiving cluster param rules for namespace <{}> from command handler: {}", namespace, data);

List<ParamFlowRule> flowRules = JSONArray.parseArray(data, ParamFlowRule.class);
ClusterParamFlowRuleManager.loadRules(namespace, flowRules);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public CommandResponse<String> handle(CommandRequest request) {
}
ClusterServerConfigManager.loadGlobalFlowConfig(config);
} else {
RecordLog.info("[ModifyClusterServerFlowConfigHandler] Receiving cluster server flow config for namespace <{0}>: {1}", namespace, data);
RecordLog.info("[ModifyClusterServerFlowConfigHandler] Receiving cluster server flow config for namespace <{}>: {}", namespace, data);
ServerFlowConfig config = JSON.parseObject(data, ServerFlowConfig.class);
if (!ClusterServerConfigManager.isValidFlowConfig(config)) {
CommandResponse.ofFailure(new IllegalArgumentException("Bad flow config"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public static void removeConnection(String address) {
return;
}
group.removeConnection(address);
RecordLog.info("[ConnectionManager] Client <{0}> disconnected and removed from namespace <{1}>", address, namespace);
RecordLog.info("[ConnectionManager] Client <{}> disconnected and removed from namespace <{}>", address, namespace);
}
NAMESPACE_MAP.remove(address);
}
Expand All @@ -87,7 +87,7 @@ public static void removeConnection(String namespace, String address) {
}
group.removeConnection(address);
NAMESPACE_MAP.remove(address);
RecordLog.info("[ConnectionManager] Client <{0}> disconnected and removed from namespace <{1}>", address, namespace);
RecordLog.info("[ConnectionManager] Client <{}> disconnected and removed from namespace <{}>", address, namespace);
}

public static ConnectionGroup addConnection(String namespace, String address) {
Expand All @@ -96,7 +96,7 @@ public static ConnectionGroup addConnection(String namespace, String address) {
ConnectionGroup group = getOrCreateGroup(namespace);
group.addConnection(address);
NAMESPACE_MAP.put(address, namespace);
RecordLog.info("[ConnectionManager] Client <{0}> registered with namespace <{1}>", address, namespace);
RecordLog.info("[ConnectionManager] Client <{}> registered with namespace <{}>", address, namespace);
return group;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ public static int statisticMaxRt() {
}
return Integer.parseInt(v);
} catch (Throwable throwable) {
RecordLog.warn("[SentinelConfig] Invalid statisticMaxRt value: {0}, using the default value instead: "
RecordLog.warn("[SentinelConfig] Invalid statisticMaxRt value: {}, using the default value instead: "
+ DEFAULT_STATISTIC_MAX_RT, v, throwable);
SentinelConfig.setConfig(STATISTIC_MAX_RT, String.valueOf(DEFAULT_STATISTIC_MAX_RT));
return DEFAULT_STATISTIC_MAX_RT;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ private static void load() {
String oldConfigValue = properties.getProperty(configKey);
properties.put(configKey, newConfigValue);
if (oldConfigValue != null) {
RecordLog.info("[SentinelConfigLoader] JVM parameter overrides {0}: {1} -> {2}",
RecordLog.info("[SentinelConfigLoader] JVM parameter overrides {}: {} -> {}",
configKey, oldConfigValue, newConfigValue);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public void setClusterNode(ClusterNode clusterNode) {
*/
public void addChild(Node node) {
if (node == null) {
RecordLog.warn("Trying to add null child to node <{0}>, ignored", id.getName());
RecordLog.warn("Trying to add null child to node <{}>, ignored", id.getName());
return;
}
if (!childList.contains(node)) {
Expand All @@ -91,7 +91,7 @@ public void addChild(Node node) {
childList = newSet;
}
}
RecordLog.info("Add child <{0}> to node <{1}>", ((DefaultNode)node).id.getName(), id.getName());
RecordLog.info("Add child <{}> to node <{}>", ((DefaultNode)node).id.getName(), id.getName());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ private Method findMethod(boolean mustStatic, Class<?> clazz, String name, Class
&& returnType.isAssignableFrom(method.getReturnType())
&& Arrays.equals(parameterTypes, method.getParameterTypes())) {

RecordLog.info("Resolved method [{0}] in class [{1}]", name, clazz.getCanonicalName());
RecordLog.info("Resolved method [{}] in class [{}]", name, clazz.getCanonicalName());
return method;
}
}
Expand All @@ -290,7 +290,7 @@ private Method findMethod(boolean mustStatic, Class<?> clazz, String name, Class
return findMethod(mustStatic, superClass, name, returnType, parameterTypes);
} else {
String methodType = mustStatic ? " static" : "";
RecordLog.warn("Cannot find{0} method [{1}] in class [{2}] with parameters {3}",
RecordLog.warn("Cannot find{} method [{}] in class [{}] with parameters {}",
methodType, name, clazz.getCanonicalName(), Arrays.toString(parameterTypes));
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,11 @@ public void run() {
String newValue = getValue.getDecodedValue();
try {
getProperty().updateValue(parser.convert(newValue));
RecordLog.info("[ConsulDataSource] New property value received for ({0}, {1}): {2}",
RecordLog.info("[ConsulDataSource] New property value received for ({}, {}): {}",
address, ruleKey, newValue);
} catch (Exception ex) {
// In case of parsing error.
RecordLog.warn("[ConsulDataSource] Failed to update value for ({0}, {1}), raw value: {2}",
RecordLog.warn("[ConsulDataSource] Failed to update value for ({}, {}), raw value: {}",
address, ruleKey, newValue);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ private void initWatcher() {
RecordLog.warn("[EtcdDataSource] Failed to update config", e);
}
} else if (eventType == WatchEvent.EventType.DELETE) {
RecordLog.info("[EtcdDataSource] Cleaning config for key <{0}>", key);
RecordLog.info("[EtcdDataSource] Cleaning config for key <{}>", key);
getProperty().updateValue(null);
}
}
Expand Down
Loading