log improvement (#11753)

This commit is contained in:
hth 2024-02-20 10:42:58 +08:00 committed by GitHub
parent 139f4f2377
commit 21f8065073
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 11 additions and 13 deletions

View File

@ -93,8 +93,8 @@ public abstract class ConnectionControlManager {
&& ruleStorageProxy.getExternalStorage().getConnectionRule() != null) { && ruleStorageProxy.getExternalStorage().getConnectionRule() != null) {
localRuleContent = ruleStorageProxy.getExternalStorage().getConnectionRule(); localRuleContent = ruleStorageProxy.getExternalStorage().getConnectionRule();
if (StringUtils.isNotBlank(localRuleContent)) { if (StringUtils.isNotBlank(localRuleContent)) {
Loggers.CONTROL Loggers.CONTROL.info("Found persist disk connection rule content on start up ,value ={}",
.info("Found persist disk connection rule content on start up ,value ={}", localRuleContent); localRuleContent);
} }
} }
@ -139,9 +139,7 @@ public abstract class ConnectionControlManager {
Collectors.toMap(ConnectionMetricsCollector::getName, ConnectionMetricsCollector::getTotalCount)); Collectors.toMap(ConnectionMetricsCollector::getName, ConnectionMetricsCollector::getTotalCount));
int totalCount = metricsTotalCount.values().stream().mapToInt(Integer::intValue).sum(); int totalCount = metricsTotalCount.values().stream().mapToInt(Integer::intValue).sum();
Loggers.CONNECTION.info(String.format("ConnectionMetrics, totalCount = %s, detail = %s", totalCount, Loggers.CONNECTION.info("ConnectionMetrics, totalCount = {}, detail = {}", totalCount, metricsTotalCount);
metricsTotalCount.toString()));
} }
} }
} }

View File

@ -42,8 +42,8 @@ public class DefaultConnectionControlManager extends ConnectionControlManager {
@Override @Override
public void applyConnectionLimitRule(ConnectionControlRule connectionControlRule) { public void applyConnectionLimitRule(ConnectionControlRule connectionControlRule) {
super.connectionControlRule = connectionControlRule; super.connectionControlRule = connectionControlRule;
Loggers.CONTROL.info("Connection control rule updated to ->" + (this.connectionControlRule == null ? null Loggers.CONTROL.info("Connection control rule updated to -> {}",
: JacksonUtils.toJson(this.connectionControlRule))); (this.connectionControlRule == null ? null : JacksonUtils.toJson(this.connectionControlRule)));
Loggers.CONTROL.warn("Connection control updated, But connection control manager is no limit implementation."); Loggers.CONTROL.warn("Connection control updated, But connection control manager is no limit implementation.");
} }

View File

@ -67,8 +67,8 @@ public class ControlRuleChangeActivator {
String persistTpsRule = ruleStorageProxy.getExternalStorage().getTpsRule(pointName); String persistTpsRule = ruleStorageProxy.getExternalStorage().getTpsRule(pointName);
ruleStorageProxy.getLocalDiskStorage().saveTpsRule(pointName, persistTpsRule); ruleStorageProxy.getLocalDiskStorage().saveTpsRule(pointName, persistTpsRule);
} else { } else {
Loggers.CONTROL Loggers.CONTROL.info(
.info("No external rule storage found,will load local disk instead,point name={}", "No external rule storage found,will load local disk instead,point name={}",
event.getPointName()); event.getPointName());
} }
@ -114,7 +114,7 @@ public class ControlRuleChangeActivator {
} }
String limitRule = ruleStorageProxy.getLocalDiskStorage().getConnectionRule(); String limitRule = ruleStorageProxy.getLocalDiskStorage().getConnectionRule();
Loggers.CONTROL.info("start to apply connection rule content " + limitRule); Loggers.CONTROL.info("start to apply connection rule content {}", limitRule);
ConnectionControlManager controlManager = ControlManagerCenter.getInstance() ConnectionControlManager controlManager = ControlManagerCenter.getInstance()
.getConnectionControlManager(); .getConnectionControlManager();
ConnectionControlRule connectionControlRule = ConnectionControlRule connectionControlRule =

View File

@ -76,7 +76,7 @@ public class LocalDiskRuleStorage implements RuleStorage {
pointFile.createNewFile(); pointFile.createNewFile();
} }
DiskUtils.writeFile(pointFile, ruleContent.getBytes(Constants.ENCODE), false); DiskUtils.writeFile(pointFile, ruleContent.getBytes(Constants.ENCODE), false);
LOGGER.info("Save connection rule to local,pointName={}, ruleContent ={} ", ruleContent); LOGGER.info("Save connection rule to local, ruleContent ={} ", ruleContent);
} }
@Override @Override

View File

@ -82,7 +82,7 @@ public abstract class TpsControlManager {
TpsControlRule tpsLimitRule = tpsControlRuleParser.parseRule(localRuleContent); TpsControlRule tpsLimitRule = tpsControlRuleParser.parseRule(localRuleContent);
this.applyTpsRule(pointName, tpsLimitRule); this.applyTpsRule(pointName, tpsLimitRule);
} else { } else {
Loggers.CONTROL.info("No tps control rule of {} found ", pointName, localRuleContent); Loggers.CONTROL.info("No tps control rule of {} found,content ={} ", pointName, localRuleContent);
} }
} }