* Optimize logging statements using placeholder to avoid unnecessary concatenation (issue #1735)master
@@ -62,8 +62,8 @@ public final class GatewayApiDefinitionManager { | |||
List<ApiDefinitionChangeObserver> listeners = SpiLoader.loadInstanceList(ApiDefinitionChangeObserver.class); | |||
for (ApiDefinitionChangeObserver e : listeners) { | |||
API_CHANGE_OBSERVERS.put(e.getClass().getCanonicalName(), e); | |||
RecordLog.info("[GatewayApiDefinitionManager] ApiDefinitionChangeObserver added: " | |||
+ e.getClass().getCanonicalName()); | |||
RecordLog.info("[GatewayApiDefinitionManager] ApiDefinitionChangeObserver added: {}" | |||
, e.getClass().getCanonicalName()); | |||
} | |||
} | |||
@@ -103,13 +103,13 @@ public final class GatewayApiDefinitionManager { | |||
@Override | |||
public void configUpdate(Set<ApiDefinition> set) { | |||
applyApiUpdateInternal(set); | |||
RecordLog.info("[GatewayApiDefinitionManager] Api definition updated: " + API_MAP); | |||
RecordLog.info("[GatewayApiDefinitionManager] Api definition updated: {}", API_MAP); | |||
} | |||
@Override | |||
public void configLoad(Set<ApiDefinition> set) { | |||
applyApiUpdateInternal(set); | |||
RecordLog.info("[GatewayApiDefinitionManager] Api definition loaded: " + API_MAP); | |||
RecordLog.info("[GatewayApiDefinitionManager] Api definition loaded: {}", API_MAP); | |||
} | |||
private static synchronized void applyApiUpdateInternal(Set<ApiDefinition> set) { | |||
@@ -51,7 +51,7 @@ public class UpdateGatewayRuleCommandHandler implements CommandHandler<String> { | |||
return CommandResponse.ofFailure(e, "decode gateway rule data error"); | |||
} | |||
RecordLog.info(String.format("[API Server] Receiving rule change (type: gateway rule): %s", data)); | |||
RecordLog.info("[API Server] Receiving rule change (type: gateway rule): {}", data); | |||
String result = SUCCESS_MSG; | |||
Set<GatewayFlowRule> flowRules = JSON.parseObject(data, new TypeReference<Set<GatewayFlowRule>>() { | |||
@@ -93,4 +93,4 @@ public class UpdateGatewayRuleCommandHandler implements CommandHandler<String> { | |||
private static final String SUCCESS_MSG = "success"; | |||
private static final String WRITE_DS_FAILURE_MSG = "partial success (write data source failed)"; | |||
} | |||
} |
@@ -149,13 +149,13 @@ public final class GatewayRuleManager { | |||
@Override | |||
public void configUpdate(Set<GatewayFlowRule> conf) { | |||
applyGatewayRuleInternal(conf); | |||
RecordLog.info("[GatewayRuleManager] Gateway flow rules received: " + GATEWAY_RULE_MAP); | |||
RecordLog.info("[GatewayRuleManager] Gateway flow rules received: {}", GATEWAY_RULE_MAP); | |||
} | |||
@Override | |||
public void configLoad(Set<GatewayFlowRule> conf) { | |||
applyGatewayRuleInternal(conf); | |||
RecordLog.info("[GatewayRuleManager] Gateway flow rules loaded: " + GATEWAY_RULE_MAP); | |||
RecordLog.info("[GatewayRuleManager] Gateway flow rules loaded: {}", GATEWAY_RULE_MAP); | |||
} | |||
private int getIdxInternal(Map<String, Integer> idxMap, String resourceName) { | |||
@@ -271,7 +271,7 @@ public final class GatewayRuleManager { | |||
CONVERTED_PARAM_RULE_MAP.clear(); | |||
CONVERTED_PARAM_RULE_MAP.putAll(newRuleMap); | |||
RecordLog.info("[GatewayRuleManager] Converted internal param rules: " + CONVERTED_PARAM_RULE_MAP); | |||
RecordLog.info("[GatewayRuleManager] Converted internal param rules: {}", CONVERTED_PARAM_RULE_MAP); | |||
} | |||
} | |||
} |
@@ -79,7 +79,7 @@ public class DefaultClusterTokenClient implements ClusterTokenClient { | |||
try { | |||
this.transportClient = new NettyTransportClient(host, port); | |||
this.serverDescriptor = new TokenServerDescriptor(host, port); | |||
RecordLog.info("[DefaultClusterTokenClient] New client created: " + serverDescriptor); | |||
RecordLog.info("[DefaultClusterTokenClient] New client created: {}", serverDescriptor); | |||
} catch (Exception ex) { | |||
RecordLog.warn("[DefaultClusterTokenClient] Failed to initialize new token client", ex); | |||
} | |||
@@ -97,7 +97,7 @@ public class DefaultClusterTokenClient implements ClusterTokenClient { | |||
this.transportClient = new NettyTransportClient(config.getServerHost(), config.getServerPort()); | |||
this.serverDescriptor = new TokenServerDescriptor(config.getServerHost(), config.getServerPort()); | |||
startClientIfScheduled(); | |||
RecordLog.info("[DefaultClusterTokenClient] New client created: " + serverDescriptor); | |||
RecordLog.info("[DefaultClusterTokenClient] New client created: {}", serverDescriptor); | |||
} catch (Exception ex) { | |||
RecordLog.warn("[DefaultClusterTokenClient] Failed to change remote token server", ex); | |||
} | |||
@@ -126,8 +126,7 @@ public class NettyTransportClient implements ClusterTransportClient { | |||
} else { | |||
failConnectedTime.set(0); | |||
channel = future.channel(); | |||
RecordLog.info( | |||
"[NettyTransportClient] Successfully connect to server <" + host + ":" + port + ">"); | |||
RecordLog.info("[NettyTransportClient] Successfully connect to server <{}:{}>", host, port); | |||
} | |||
} | |||
}); | |||
@@ -144,7 +143,7 @@ public class NettyTransportClient implements ClusterTransportClient { | |||
@Override | |||
public void run() { | |||
if (shouldRetry.get()) { | |||
RecordLog.info("[NettyTransportClient] Reconnecting to server <" + host + ":" + port + ">"); | |||
RecordLog.info("[NettyTransportClient] Reconnecting to server <{}:{}>", host, port); | |||
try { | |||
startInternal(); | |||
} catch (Exception e) { | |||
@@ -39,14 +39,16 @@ public final class ClientEntityCodecProvider { | |||
RecordLog.warn("[ClientEntityCodecProvider] No existing request entity writer, resolve failed"); | |||
} else { | |||
requestEntityWriter = writer; | |||
RecordLog.info("[ClientEntityCodecProvider] Request entity writer resolved: " + requestEntityWriter.getClass().getCanonicalName()); | |||
RecordLog.info("[ClientEntityCodecProvider] Request entity writer resolved: {}", | |||
requestEntityWriter.getClass().getCanonicalName()); | |||
} | |||
ResponseEntityDecoder decoder = SpiLoader.loadFirstInstance(ResponseEntityDecoder.class); | |||
if (decoder == null) { | |||
RecordLog.warn("[ClientEntityCodecProvider] No existing response entity decoder, resolve failed"); | |||
} else { | |||
responseEntityDecoder = decoder; | |||
RecordLog.info("[ClientEntityCodecProvider] Response entity decoder resolved: " + responseEntityDecoder.getClass().getCanonicalName()); | |||
RecordLog.info("[ClientEntityCodecProvider] Response entity decoder resolved: {}", | |||
responseEntityDecoder.getClass().getCanonicalName()); | |||
} | |||
} | |||
@@ -131,7 +131,7 @@ public final class ClusterClientConfigManager { | |||
return; | |||
} | |||
RecordLog.info("[ClusterClientConfigManager] Assign to new target token server: " + config); | |||
RecordLog.info("[ClusterClientConfigManager] Assign to new target token server: {}", config); | |||
updateServerAssignment(config); | |||
} | |||
@@ -156,11 +156,11 @@ public final class ClusterClientConfigManager { | |||
private synchronized void applyConfig(ClusterClientConfig config) { | |||
if (!isValidClientConfig(config)) { | |||
RecordLog.warn( | |||
"[ClusterClientConfigManager] Invalid cluster client config, ignoring: " + config); | |||
"[ClusterClientConfigManager] Invalid cluster client config, ignoring: {}", config); | |||
return; | |||
} | |||
RecordLog.info("[ClusterClientConfigManager] Updating to new client config: " + config); | |||
RecordLog.info("[ClusterClientConfigManager] Updating to new client config: {}", config); | |||
updateClientConfigChange(config); | |||
} | |||
@@ -48,7 +48,7 @@ public class TokenClientHandler extends ChannelInboundHandlerAdapter { | |||
public void channelActive(ChannelHandlerContext ctx) throws Exception { | |||
currentState.set(ClientConstants.CLIENT_STATUS_STARTED); | |||
fireClientPing(ctx); | |||
RecordLog.info("[TokenClientHandler] Client handler active, remote address: " + getRemoteAddress(ctx)); | |||
RecordLog.info("[TokenClientHandler] Client handler active, remote address: {}", getRemoteAddress(ctx)); | |||
} | |||
@Override | |||
@@ -90,12 +90,12 @@ public class TokenClientHandler extends ChannelInboundHandlerAdapter { | |||
@Override | |||
public void channelInactive(ChannelHandlerContext ctx) throws Exception { | |||
RecordLog.info("[TokenClientHandler] Client handler inactive, remote address: " + getRemoteAddress(ctx)); | |||
RecordLog.info("[TokenClientHandler] Client handler inactive, remote address: {}", getRemoteAddress(ctx)); | |||
} | |||
@Override | |||
public void channelUnregistered(ChannelHandlerContext ctx) throws Exception { | |||
RecordLog.info("[TokenClientHandler] Client channel unregistered, remote address: " + getRemoteAddress(ctx)); | |||
RecordLog.info("[TokenClientHandler] Client channel unregistered, remote address: {}", getRemoteAddress(ctx)); | |||
currentState.set(ClientConstants.CLIENT_STATUS_OFF); | |||
disconnectCallback.run(); | |||
@@ -44,7 +44,7 @@ public class ModifyClusterClientConfigHandler implements CommandHandler<String> | |||
} | |||
try { | |||
data = URLDecoder.decode(data, "utf-8"); | |||
RecordLog.info("[ModifyClusterClientConfigHandler] Receiving cluster client config: " + data); | |||
RecordLog.info("[ModifyClusterClientConfigHandler] Receiving cluster client config: {}", data); | |||
ClusterClientStateEntity entity = JSON.parseObject(data, ClusterClientStateEntity.class); | |||
ClusterClientConfigManager.applyNewConfig(entity.toClientConfig()); | |||
@@ -52,8 +52,8 @@ public final class ConfigSupplierRegistry { | |||
public static void setNamespaceSupplier(Supplier<String> namespaceSupplier) { | |||
AssertUtil.notNull(namespaceSupplier, "namespaceSupplier cannot be null"); | |||
ConfigSupplierRegistry.namespaceSupplier = namespaceSupplier; | |||
RecordLog.info("[ConfigSupplierRegistry] New namespace supplier provided, current supplied: " | |||
+ namespaceSupplier.get()); | |||
RecordLog.info("[ConfigSupplierRegistry] New namespace supplier provided, current supplied: {}", | |||
namespaceSupplier.get()); | |||
} | |||
private ConfigSupplierRegistry() {} | |||
@@ -97,7 +97,7 @@ public class RegularExpireStrategy implements ExpireStrategy { | |||
for (int i = 0; i < executeCount && i < keyList.size(); i++) { | |||
// time out execution exit | |||
if (System.currentTimeMillis() - start > executeDuration) { | |||
RecordLog.info("[RegularExpireStrategy] End the process of expired token detection because of execute time is more than executeDuration:", executeDuration); | |||
RecordLog.info("[RegularExpireStrategy] End the process of expired token detection because of execute time is more than executeDuration: {}", executeDuration); | |||
break; | |||
} | |||
Long key = keyList.get(i); | |||
@@ -118,7 +118,7 @@ public class NettyTransportServer implements ClusterTokenServer { | |||
RecordLog.info("[NettyTransportServer] Failed to start token server when retrying", e); | |||
} | |||
} else { | |||
RecordLog.info("[NettyTransportServer] Token server started success at port " + port); | |||
RecordLog.info("[NettyTransportServer] Token server started success at port {}", port); | |||
currentState.compareAndSet(SERVER_STATUS_STARTING, SERVER_STATUS_STARTED); | |||
} | |||
} | |||
@@ -39,18 +39,16 @@ public final class ServerEntityCodecProvider { | |||
RecordLog.warn("[ServerEntityCodecProvider] No existing response entity writer, resolve failed"); | |||
} else { | |||
responseEntityWriter = writer; | |||
RecordLog.info( | |||
"[ServerEntityCodecProvider] Response entity writer resolved: " + responseEntityWriter.getClass() | |||
.getCanonicalName()); | |||
RecordLog.info("[ServerEntityCodecProvider] Response entity writer resolved: {}", | |||
responseEntityWriter.getClass().getCanonicalName()); | |||
} | |||
RequestEntityDecoder decoder = SpiLoader.loadFirstInstance(RequestEntityDecoder.class); | |||
if (decoder == null) { | |||
RecordLog.warn("[ServerEntityCodecProvider] No existing request entity decoder, resolve failed"); | |||
} else { | |||
requestEntityDecoder = decoder; | |||
RecordLog.info( | |||
"[ServerEntityCodecProvider] Request entity decoder resolved: " + requestEntityDecoder.getClass() | |||
.getCanonicalName()); | |||
RecordLog.info("[ServerEntityCodecProvider] Request entity decoder resolved: {}", | |||
requestEntityDecoder.getClass().getCanonicalName()); | |||
} | |||
} | |||
@@ -46,7 +46,7 @@ public class ModifyClusterServerFlowConfigHandler implements CommandHandler<Stri | |||
data = URLDecoder.decode(data, "utf-8"); | |||
if (StringUtil.isEmpty(namespace)) { | |||
RecordLog.info("[ModifyClusterServerFlowConfigHandler] Receiving cluster server global flow config: " + data); | |||
RecordLog.info("[ModifyClusterServerFlowConfigHandler] Receiving cluster server global flow config: {}", data); | |||
ServerFlowConfig config = JSON.parseObject(data, ServerFlowConfig.class); | |||
if (!ClusterServerConfigManager.isValidFlowConfig(config)) { | |||
CommandResponse.ofFailure(new IllegalArgumentException("Bad flow config")); | |||
@@ -44,7 +44,7 @@ public class ModifyServerNamespaceSetHandler implements CommandHandler<String> { | |||
} | |||
try { | |||
data = URLDecoder.decode(data, "utf-8"); | |||
RecordLog.info("[ModifyServerNamespaceSetHandler] Receiving cluster server namespace set: " + data); | |||
RecordLog.info("[ModifyServerNamespaceSetHandler] Receiving cluster server namespace set: {}", data); | |||
Set<String> set = JSON.parseObject(data, new TypeReference<Set<String>>() {}); | |||
ClusterServerConfigManager.loadServerNamespaceSet(set); | |||
return CommandResponse.ofSuccess("success"); | |||
@@ -219,7 +219,7 @@ public final class ClusterServerConfigManager { | |||
if (newSet == null) { | |||
return; | |||
} | |||
RecordLog.info("[ClusterServerConfigManager] Server namespace set will be update to: " + newSet); | |||
RecordLog.info("[ClusterServerConfigManager] Server namespace set will be update to: {}", newSet); | |||
if (newSet.isEmpty()) { | |||
ClusterServerConfigManager.namespaceSet = Collections.singleton(ServerConstants.DEFAULT_NAMESPACE); | |||
return; | |||
@@ -276,10 +276,10 @@ public final class ClusterServerConfigManager { | |||
private synchronized void applyConfig(ServerTransportConfig config) { | |||
if (!isValidTransportConfig(config)) { | |||
RecordLog.warn( | |||
"[ClusterServerConfigManager] Invalid cluster server transport config, ignoring: " + config); | |||
"[ClusterServerConfigManager] Invalid cluster server transport config, ignoring: {}", config); | |||
return; | |||
} | |||
RecordLog.info("[ClusterServerConfigManager] Updating new server transport config: " + config); | |||
RecordLog.info("[ClusterServerConfigManager] Updating new server transport config: {}", config); | |||
if (config.getIdleSeconds() != idleSeconds) { | |||
idleSeconds = config.getIdleSeconds(); | |||
} | |||
@@ -315,10 +315,10 @@ public final class ClusterServerConfigManager { | |||
private synchronized void applyGlobalFlowConfig(ServerFlowConfig config) { | |||
if (!isValidFlowConfig(config)) { | |||
RecordLog.warn( | |||
"[ClusterServerConfigManager] Invalid cluster server global flow config, ignoring: " + config); | |||
"[ClusterServerConfigManager] Invalid cluster server global flow config, ignoring: {}", config); | |||
return; | |||
} | |||
RecordLog.info("[ClusterServerConfigManager] Updating new server global flow config: " + config); | |||
RecordLog.info("[ClusterServerConfigManager] Updating new server global flow config: {}", config); | |||
if (config.getExceedCount() != exceedCount) { | |||
exceedCount = config.getExceedCount(); | |||
} | |||
@@ -31,10 +31,8 @@ public class ScanIdleConnectionTask implements Runnable { | |||
List<Connection> connections = connectionPool.listAllConnection(); | |||
for (Connection conn : connections) { | |||
if ((now - conn.getLastReadTime()) > idleTimeMillis) { | |||
RecordLog.info( | |||
String.format("[ScanIdleConnectionTask] The connection <%s:%d> has been idle for <%d>s. " | |||
+ "It will be closed now.", conn.getRemoteIP(), conn.getRemotePort(), idleSeconds) | |||
); | |||
RecordLog.info("[ScanIdleConnectionTask] The connection <{}:{}> has been idle for <{}>s. It will be closed now.", | |||
conn.getRemoteIP(), conn.getRemotePort(), idleSeconds); | |||
conn.close(); | |||
} | |||
} | |||
@@ -91,7 +91,7 @@ public final class EnvoyRlsRuleManager { | |||
RULE_MAP.clear(); | |||
RULE_MAP.putAll(ruleMap); | |||
RecordLog.info("[EnvoyRlsRuleManager] Envoy RLS rules loaded: " + flowRules); | |||
RecordLog.info("[EnvoyRlsRuleManager] Envoy RLS rules loaded: {}", flowRules); | |||
// Use the "default" namespace. | |||
ClusterFlowRuleManager.loadRules(ServerConstants.DEFAULT_NAMESPACE, flowRules); | |||
@@ -44,8 +44,8 @@ public final class TokenClientProvider { | |||
"[TokenClientProvider] No existing cluster token client, cluster client mode will not be activated"); | |||
} else { | |||
client = resolvedClient; | |||
RecordLog.info( | |||
"[TokenClientProvider] Cluster token client resolved: " + client.getClass().getCanonicalName()); | |||
RecordLog.info("[TokenClientProvider] Cluster token client resolved: {}", | |||
client.getClass().getCanonicalName()); | |||
} | |||
} | |||
@@ -36,7 +36,8 @@ public final class EmbeddedClusterTokenServerProvider { | |||
RecordLog.warn("[EmbeddedClusterTokenServerProvider] No existing cluster token server, cluster server mode will not be activated"); | |||
} else { | |||
server = s; | |||
RecordLog.info("[EmbeddedClusterTokenServerProvider] Cluster token server resolved: " + server.getClass().getCanonicalName()); | |||
RecordLog.info("[EmbeddedClusterTokenServerProvider] Cluster token server resolved: {}", | |||
server.getClass().getCanonicalName()); | |||
} | |||
} | |||
@@ -68,7 +68,7 @@ public final class SentinelConfig { | |||
loadProps(); | |||
resolveAppName(); | |||
resolveAppType(); | |||
RecordLog.info("[SentinelConfig] Application type resolved: " + appType); | |||
RecordLog.info("[SentinelConfig] Application type resolved: {}", appType); | |||
} catch (Throwable ex) { | |||
RecordLog.warn("[SentinelConfig] Failed to initialize", ex); | |||
ex.printStackTrace(); | |||
@@ -62,7 +62,7 @@ public final class SentinelConfigLoader { | |||
Properties p = ConfigUtil.loadProperties(fileName); | |||
if (p != null && !p.isEmpty()) { | |||
RecordLog.info("[SentinelConfigLoader] Loading Sentinel config from " + fileName); | |||
RecordLog.info("[SentinelConfigLoader] Loading Sentinel config from {}", fileName); | |||
properties.putAll(p); | |||
} | |||
@@ -46,13 +46,13 @@ public final class InitExecutor { | |||
ServiceLoader<InitFunc> loader = ServiceLoaderUtil.getServiceLoader(InitFunc.class); | |||
List<OrderWrapper> initList = new ArrayList<OrderWrapper>(); | |||
for (InitFunc initFunc : loader) { | |||
RecordLog.info("[InitExecutor] Found init func: " + initFunc.getClass().getCanonicalName()); | |||
RecordLog.info("[InitExecutor] Found init func: {}", initFunc.getClass().getCanonicalName()); | |||
insertSorted(initList, initFunc); | |||
} | |||
for (OrderWrapper w : initList) { | |||
w.func.init(); | |||
RecordLog.info(String.format("[InitExecutor] Executing %s with order %d", | |||
w.func.getClass().getCanonicalName(), w.order)); | |||
RecordLog.info("[InitExecutor] Executing {} with order {}", | |||
w.func.getClass().getCanonicalName(), w.order); | |||
} | |||
} catch (Exception ex) { | |||
RecordLog.warn("[InitExecutor] WARN: Initialization failed", ex); | |||
@@ -41,7 +41,7 @@ public class MetricExtensionProvider { | |||
RecordLog.info("[MetricExtensionProvider] No existing MetricExtension found"); | |||
} else { | |||
metricExtensions.addAll(extensions); | |||
RecordLog.info("[MetricExtensionProvider] MetricExtension resolved, size=" + extensions.size()); | |||
RecordLog.info("[MetricExtensionProvider] MetricExtension resolved, size={}", extensions.size()); | |||
} | |||
} | |||
@@ -62,7 +62,7 @@ public class IntervalProperty { | |||
INTERVAL = newInterval; | |||
ClusterBuilderSlot.resetClusterNodes(); | |||
} | |||
RecordLog.info("[IntervalProperty] INTERVAL updated to: " + INTERVAL); | |||
RecordLog.info("[IntervalProperty] INTERVAL updated to: {}", INTERVAL); | |||
} | |||
} |
@@ -67,13 +67,13 @@ public class OccupyTimeoutProperty { | |||
return; | |||
} | |||
if (newInterval > IntervalProperty.INTERVAL) { | |||
RecordLog.warn("[OccupyTimeoutProperty] Illegal timeout value will be ignored: " + occupyTimeout | |||
+ ", should <= " + IntervalProperty.INTERVAL); | |||
RecordLog.warn("[OccupyTimeoutProperty] Illegal timeout value will be ignored: {}, should <= {}", | |||
occupyTimeout, IntervalProperty.INTERVAL); | |||
return; | |||
} | |||
if (newInterval != occupyTimeout) { | |||
occupyTimeout = newInterval; | |||
} | |||
RecordLog.info("[OccupyTimeoutProperty] occupyTimeout updated to: " + occupyTimeout); | |||
RecordLog.info("[OccupyTimeoutProperty] occupyTimeout updated to: {}", occupyTimeout); | |||
} | |||
} |
@@ -60,6 +60,6 @@ public class SampleCountProperty { | |||
SAMPLE_COUNT = newSampleCount; | |||
ClusterBuilderSlot.resetClusterNodes(); | |||
} | |||
RecordLog.info("SAMPLE_COUNT updated to: " + SAMPLE_COUNT); | |||
RecordLog.info("SAMPLE_COUNT updated to: {}", SAMPLE_COUNT); | |||
} | |||
} |
@@ -92,9 +92,8 @@ public class MetricWriter { | |||
if (singleFileSize <= 0 || totalFileCount <= 0) { | |||
throw new IllegalArgumentException(); | |||
} | |||
RecordLog.info( | |||
"[MetricWriter] Creating new MetricWriter, singleFileSize=" + singleFileSize + ", totalFileCount=" | |||
+ totalFileCount); | |||
RecordLog.info("[MetricWriter] Creating new MetricWriter, singleFileSize={}, totalFileCount={}", | |||
singleFileSize, totalFileCount); | |||
this.baseDir = METRIC_BASE_DIR; | |||
File dir = new File(baseDir); | |||
if (!dir.exists()) { | |||
@@ -328,9 +327,9 @@ public class MetricWriter { | |||
String fileName = list.get(i); | |||
String indexFile = formIndexFileName(fileName); | |||
new File(fileName).delete(); | |||
RecordLog.info("[MetricWriter] Removing metric file: " + fileName); | |||
RecordLog.info("[MetricWriter] Removing metric file: {}", fileName); | |||
new File(indexFile).delete(); | |||
RecordLog.info("[MetricWriter] Removing metric index file: " + indexFile); | |||
RecordLog.info("[MetricWriter] Removing metric index file: {}", indexFile); | |||
} | |||
} | |||
@@ -348,8 +347,8 @@ public class MetricWriter { | |||
String idxFile = formIndexFileName(fileName); | |||
curMetricIndexFile = new File(idxFile); | |||
outIndex = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(idxFile, append))); | |||
RecordLog.info("[MetricWriter] New metric file created: " + fileName); | |||
RecordLog.info("[MetricWriter] New metric index file created: " + idxFile); | |||
RecordLog.info("[MetricWriter] New metric file created: {}", fileName); | |||
RecordLog.info("[MetricWriter] New metric index file created: {}", idxFile); | |||
} | |||
private boolean validSize() throws Exception { | |||
@@ -50,7 +50,7 @@ public class DynamicSentinelProperty<T> implements SentinelProperty<T> { | |||
if (isEqual(value, newValue)) { | |||
return false; | |||
} | |||
RecordLog.info("[DynamicSentinelProperty] Config will be updated to: " + newValue); | |||
RecordLog.info("[DynamicSentinelProperty] Config will be updated to: {}", newValue); | |||
value = newValue; | |||
for (PropertyListener<T> listener : listeners) { | |||
@@ -48,8 +48,8 @@ public final class SlotChainProvider { | |||
RecordLog.warn("[SlotChainProvider] Wrong state when resolving slot chain builder, using default"); | |||
slotChainBuilder = new DefaultSlotChainBuilder(); | |||
} else { | |||
RecordLog.info("[SlotChainProvider] Global slot chain builder resolved: " | |||
+ slotChainBuilder.getClass().getCanonicalName()); | |||
RecordLog.info("[SlotChainProvider] Global slot chain builder resolved: {}", | |||
slotChainBuilder.getClass().getCanonicalName()); | |||
} | |||
return slotChainBuilder.build(); | |||
} | |||
@@ -99,7 +99,7 @@ public final class AuthorityRuleManager { | |||
if (rules != null) { | |||
authorityRules.putAll(rules); | |||
} | |||
RecordLog.info("[AuthorityRuleManager] Authority rules received: " + authorityRules); | |||
RecordLog.info("[AuthorityRuleManager] Authority rules received: {}", authorityRules); | |||
} | |||
private Map<String, Set<AuthorityRule>> loadAuthorityConf(List<AuthorityRule> list) { | |||
@@ -111,7 +111,7 @@ public final class AuthorityRuleManager { | |||
for (AuthorityRule rule : list) { | |||
if (!isValidRule(rule)) { | |||
RecordLog.warn("[AuthorityRuleManager] Ignoring invalid authority rule when loading new rules: " + rule); | |||
RecordLog.warn("[AuthorityRuleManager] Ignoring invalid authority rule when loading new rules: {}", rule); | |||
continue; | |||
} | |||
@@ -128,7 +128,7 @@ public final class AuthorityRuleManager { | |||
newRuleMap.put(identity, ruleSet); | |||
} else { | |||
// One resource should only have at most one authority rule, so just ignore redundant rules. | |||
RecordLog.warn("[AuthorityRuleManager] Ignoring redundant rule: " + rule.toString()); | |||
RecordLog.warn("[AuthorityRuleManager] Ignoring redundant rule: {}", rule.toString()); | |||
} | |||
} | |||
@@ -143,7 +143,7 @@ public final class AuthorityRuleManager { | |||
if (rules != null) { | |||
authorityRules.putAll(rules); | |||
} | |||
RecordLog.info("[AuthorityRuleManager] Load authority rules: " + authorityRules); | |||
RecordLog.info("[AuthorityRuleManager] Load authority rules: {}", authorityRules); | |||
} | |||
} | |||
@@ -224,13 +224,13 @@ public final class DegradeRuleManager { | |||
@Override | |||
public void configUpdate(List<DegradeRule> conf) { | |||
reloadFrom(conf); | |||
RecordLog.info("[DegradeRuleManager] Degrade rules has been updated to: " + ruleMap); | |||
RecordLog.info("[DegradeRuleManager] Degrade rules has been updated to: {}", ruleMap); | |||
} | |||
@Override | |||
public void configLoad(List<DegradeRule> conf) { | |||
reloadFrom(conf); | |||
RecordLog.info("[DegradeRuleManager] Degrade rules loaded: " + ruleMap); | |||
RecordLog.info("[DegradeRuleManager] Degrade rules loaded: {}", ruleMap); | |||
} | |||
private Map<String, List<CircuitBreaker>> buildCircuitBreakers(List<DegradeRule> list) { | |||
@@ -240,7 +240,7 @@ public final class DegradeRuleManager { | |||
} | |||
for (DegradeRule rule : list) { | |||
if (!isValidRule(rule)) { | |||
RecordLog.warn("[DegradeRuleManager] Ignoring invalid rule when loading new rules: " + rule); | |||
RecordLog.warn("[DegradeRuleManager] Ignoring invalid rule when loading new rules: {}", rule); | |||
continue; | |||
} | |||
@@ -249,7 +249,7 @@ public final class DegradeRuleManager { | |||
} | |||
CircuitBreaker cb = getExistingSameCbOrNew(rule); | |||
if (cb == null) { | |||
RecordLog.warn("[DegradeRuleManager] Unknown circuit breaking strategy, ignoring: " + rule); | |||
RecordLog.warn("[DegradeRuleManager] Unknown circuit breaking strategy, ignoring: {}", rule); | |||
continue; | |||
} | |||
@@ -133,7 +133,7 @@ public class FlowRuleManager { | |||
flowRules.clear(); | |||
flowRules.putAll(rules); | |||
} | |||
RecordLog.info("[FlowRuleManager] Flow rules received: " + flowRules); | |||
RecordLog.info("[FlowRuleManager] Flow rules received: {}", flowRules); | |||
} | |||
@Override | |||
@@ -143,7 +143,7 @@ public class FlowRuleManager { | |||
flowRules.clear(); | |||
flowRules.putAll(rules); | |||
} | |||
RecordLog.info("[FlowRuleManager] Flow rules loaded: " + flowRules); | |||
RecordLog.info("[FlowRuleManager] Flow rules loaded: {}", flowRules); | |||
} | |||
} | |||
@@ -53,7 +53,7 @@ public class ApolloDataSource<T> extends AbstractDataSource<String, T> { | |||
initialize(); | |||
RecordLog.info(String.format("Initialized rule for namespace: %s, rule key: %s", namespaceName, ruleKey)); | |||
RecordLog.info("Initialized rule for namespace: {}, rule key: {}", namespaceName, ruleKey); | |||
} | |||
private void initialize() { | |||
@@ -80,7 +80,7 @@ public class ApolloDataSource<T> extends AbstractDataSource<String, T> { | |||
ConfigChange change = changeEvent.getChange(ruleKey); | |||
//change is never null because the listener will only notify for this key | |||
if (change != null) { | |||
RecordLog.info("[ApolloDataSource] Received config changes: " + change.toString()); | |||
RecordLog.info("[ApolloDataSource] Received config changes: {}", change); | |||
} | |||
loadAndUpdateRules(); | |||
} | |||
@@ -73,7 +73,7 @@ public class FileWritableDataSource<T> implements WritableDataSource<T> { | |||
outputStream = new FileOutputStream(file); | |||
byte[] bytesArray = convertResult.getBytes(charset); | |||
RecordLog.info(String.format("[FileWritableDataSource] Writing to file %s: %s", file.toString(), convertResult)); | |||
RecordLog.info("[FileWritableDataSource] Writing to file {}: {}", file, convertResult); | |||
outputStream.write(bytesArray); | |||
outputStream.flush(); | |||
} finally { | |||
@@ -99,8 +99,8 @@ public class NacosDataSource<T> extends AbstractDataSource<String, T> { | |||
@Override | |||
public void receiveConfigInfo(final String configInfo) { | |||
RecordLog.info(String.format("[NacosDataSource] New property value received for (properties: %s) (dataId: %s, groupId: %s): %s", | |||
properties, dataId, groupId, configInfo)); | |||
RecordLog.info("[NacosDataSource] New property value received for (properties: {}) (dataId: {}, groupId: {}): {}", | |||
properties, dataId, groupId, configInfo); | |||
T newValue = NacosDataSource.this.parser.convert(configInfo); | |||
// Update the new value to the property. | |||
getProperty().updateValue(newValue); | |||
@@ -172,7 +172,7 @@ public class RedisDataSource<T> extends AbstractDataSource<String, T> { | |||
@Override | |||
public void message(String channel, String message) { | |||
RecordLog.info(String.format("[RedisDataSource] New property value received for channel %s: %s", channel, message)); | |||
RecordLog.info("[RedisDataSource] New property value received for channel {}: {}", channel, message); | |||
getProperty().updateValue(parser.convert(message)); | |||
} | |||
} | |||
@@ -147,11 +147,10 @@ public class SentinelRuleLocator implements PropertySourceLocator { | |||
private void log(Environment result) { | |||
RecordLog.info(String.format( | |||
"Located environment: name=%s, profiles=%s, label=%s, version=%s, state=%s", | |||
RecordLog.info("Located environment: name={}, profiles={}, label={}, version={}, state={}", | |||
result.getName(), | |||
result.getProfiles() == null ? "" : Arrays.asList(result.getProfiles()), | |||
result.getLabel(), result.getVersion(), result.getState())); | |||
result.getLabel(), result.getVersion(), result.getState()); | |||
List<PropertySource> propertySourceList = result.getPropertySources(); | |||
if (propertySourceList != null) { | |||
@@ -194,7 +193,7 @@ public class SentinelRuleLocator implements PropertySourceLocator { | |||
String username = credentials.getUsername(); | |||
String password = credentials.getPassword(); | |||
RecordLog.info("[SentinelRuleLocator] Fetching config from server at: " + uri); | |||
RecordLog.info("[SentinelRuleLocator] Fetching config from server at: {}", uri); | |||
try { | |||
HttpHeaders headers = new HttpHeaders(); | |||
@@ -110,8 +110,8 @@ public class ZookeeperDataSource<T> extends AbstractDataSource<String, T> { | |||
try { | |||
T newValue = loadConfig(); | |||
RecordLog.info(String.format("[ZookeeperDataSource] New property value received for (%s, %s): %s", | |||
serverAddr, path, newValue)); | |||
RecordLog.info("[ZookeeperDataSource] New property value received for ({}, {}): {}", | |||
serverAddr, path, newValue); | |||
// Update the new value to the property. | |||
getProperty().updateValue(newValue); | |||
} catch (Exception ex) { | |||
@@ -51,7 +51,7 @@ public class ModifyParamFlowRulesCommandHandler implements CommandHandler<String | |||
return CommandResponse.ofFailure(e, "decode rule data error"); | |||
} | |||
RecordLog.info(String.format("[API Server] Receiving rule change (type:parameter flow rule): %s", data)); | |||
RecordLog.info("[API Server] Receiving rule change (type:parameter flow rule): {}", data); | |||
String result = SUCCESS_MSG; | |||
List<ParamFlowRule> flowRules = JSONArray.parseArray(data, ParamFlowRule.class); | |||
@@ -105,7 +105,7 @@ public final class ParamFlowRuleManager { | |||
PARAM_FLOW_RULES.clear(); | |||
PARAM_FLOW_RULES.putAll(rules); | |||
} | |||
RecordLog.info("[ParamFlowRuleManager] Parameter flow rules received: " + PARAM_FLOW_RULES); | |||
RecordLog.info("[ParamFlowRuleManager] Parameter flow rules received: {}", PARAM_FLOW_RULES); | |||
} | |||
@Override | |||
@@ -115,7 +115,7 @@ public final class ParamFlowRuleManager { | |||
PARAM_FLOW_RULES.clear(); | |||
PARAM_FLOW_RULES.putAll(rules); | |||
} | |||
RecordLog.info("[ParamFlowRuleManager] Parameter flow rules received: " + PARAM_FLOW_RULES); | |||
RecordLog.info("[ParamFlowRuleManager] Parameter flow rules received: {}", PARAM_FLOW_RULES); | |||
} | |||
private Map<String, List<ParamFlowRule>> aggregateAndPrepareParamRules(List<ParamFlowRule> list) { | |||
@@ -54,7 +54,7 @@ public final class ParameterMetricStorage { | |||
if ((metric = metricsMap.get(resourceName)) == null) { | |||
metric = new ParameterMetric(); | |||
metricsMap.put(resourceWrapper.getName(), metric); | |||
RecordLog.info("[ParameterMetricStorage] Creating parameter metric for: " + resourceWrapper.getName()); | |||
RecordLog.info("[ParameterMetricStorage] Creating parameter metric for: {}", resourceWrapper.getName()); | |||
} | |||
} | |||
} | |||
@@ -80,7 +80,7 @@ public final class ParameterMetricStorage { | |||
return; | |||
} | |||
metricsMap.remove(resourceName); | |||
RecordLog.info("[ParameterMetricStorage] Clearing parameter metric for: " + resourceName); | |||
RecordLog.info("[ParameterMetricStorage] Clearing parameter metric for: {}", resourceName); | |||
} | |||
static Map<String, ParameterMetric> getMetricsMap() { | |||
@@ -40,7 +40,7 @@ public final class CommandCenterProvider { | |||
RecordLog.warn("[CommandCenterProvider] WARN: No existing CommandCenter found"); | |||
} else { | |||
commandCenter = resolveCommandCenter; | |||
RecordLog.info("[CommandCenterProvider] CommandCenter resolved: " + resolveCommandCenter.getClass() | |||
RecordLog.info("[CommandCenterProvider] CommandCenter resolved: {}", resolveCommandCenter.getClass() | |||
.getCanonicalName()); | |||
} | |||
} | |||
@@ -41,7 +41,7 @@ public class ModifyClusterModeCommandHandler implements CommandHandler<String> { | |||
if (mode == ClusterStateManager.CLUSTER_SERVER && !isClusterServerSpiAvailable()) { | |||
return CommandResponse.ofFailure(new IllegalStateException("token server mode not available: no SPI found")); | |||
} | |||
RecordLog.info("[ModifyClusterModeCommandHandler] Modifying cluster mode to: " + mode); | |||
RecordLog.info("[ModifyClusterModeCommandHandler] Modifying cluster mode to: {}", mode); | |||
ClusterStateManager.applyState(mode); | |||
return CommandResponse.ofSuccess("success"); | |||
@@ -37,7 +37,7 @@ public final class HeartbeatSenderProvider { | |||
RecordLog.warn("[HeartbeatSenderProvider] WARN: No existing HeartbeatSender found"); | |||
} else { | |||
heartbeatSender = resolved; | |||
RecordLog.info("[HeartbeatSenderProvider] HeartbeatSender activated: " + resolved.getClass() | |||
RecordLog.info("[HeartbeatSenderProvider] HeartbeatSender activated: {}", resolved.getClass() | |||
.getCanonicalName()); | |||
} | |||
} | |||
@@ -67,8 +67,7 @@ public class HttpHeartbeatSender implements HeartbeatSender { | |||
} else { | |||
consoleHost = dashboardList.get(0).r1; | |||
consolePort = dashboardList.get(0).r2; | |||
RecordLog.info( | |||
"[NettyHttpHeartbeatSender] Dashboard address parsed: <" + consoleHost + ':' + consolePort + ">"); | |||
RecordLog.info("[NettyHttpHeartbeatSender] Dashboard address parsed: <{}:{}>", consoleHost, consolePort); | |||
} | |||
} | |||
@@ -52,7 +52,7 @@ public class SimpleHttpHeartbeatSender implements HeartbeatSender { | |||
if (newAddrs.isEmpty()) { | |||
RecordLog.warn("[SimpleHttpHeartbeatSender] Dashboard server address not configured or not available"); | |||
} else { | |||
RecordLog.info("[SimpleHttpHeartbeatSender] Default console address list retrieved: " + newAddrs); | |||
RecordLog.info("[SimpleHttpHeartbeatSender] Default console address list retrieved: {}", newAddrs); | |||
} | |||
this.addressList = newAddrs; | |||
} | |||