mirror of
https://github.com/didi/KnowStreaming.git
synced 2025-12-24 03:42:07 +08:00
[Optimize]日志统一格式&优化输出内容-part3(#800)
This commit is contained in:
@@ -307,7 +307,7 @@ public class TopicStateManagerImpl implements TopicStateManager {
|
||||
if (metricsResult.failed()) {
|
||||
// 仅打印错误日志,但是不直接返回错误
|
||||
log.error(
|
||||
"class=TopicStateManagerImpl||method=getTopicPartitions||clusterPhyId={}||topicName={}||result={}||msg=get metrics from es failed",
|
||||
"method=getTopicPartitions||clusterPhyId={}||topicName={}||result={}||msg=get metrics from es failed",
|
||||
clusterPhyId, topicName, metricsResult
|
||||
);
|
||||
}
|
||||
|
||||
@@ -99,13 +99,13 @@ public class ConfigCmdDataParser implements FourLetterWordDataParser<ConfigCmdDa
|
||||
break;
|
||||
default:
|
||||
LOGGER.warn(
|
||||
"class=ConfigCmdDataParser||method=parseAndInitData||name={}||value={}||msg=data not parsed!",
|
||||
"method=parseAndInitData||name={}||value={}||msg=data not parsed!",
|
||||
elem.getKey(), elem.getValue()
|
||||
);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LOGGER.error(
|
||||
"class=ConfigCmdDataParser||method=parseAndInitData||clusterPhyId={}||host={}||port={}||name={}||value={}||errMsg=exception!",
|
||||
"method=parseAndInitData||clusterPhyId={}||host={}||port={}||name={}||value={}||errMsg=exception!",
|
||||
clusterPhyId, host, port, elem.getKey(), elem.getValue(), e
|
||||
);
|
||||
}
|
||||
|
||||
@@ -100,13 +100,13 @@ public class MonitorCmdDataParser implements FourLetterWordDataParser<MonitorCmd
|
||||
break;
|
||||
default:
|
||||
LOGGER.warn(
|
||||
"class=MonitorCmdDataParser||method=parseAndInitData||name={}||value={}||msg=data not parsed!",
|
||||
"method=parseAndInitData||name={}||value={}||msg=data not parsed!",
|
||||
elem.getKey(), elem.getValue()
|
||||
);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LOGGER.error(
|
||||
"class=MonitorCmdDataParser||method=parseAndInitData||clusterPhyId={}||host={}||port={}||name={}||value={}||errMsg=exception!",
|
||||
"method=parseAndInitData||clusterPhyId={}||host={}||port={}||name={}||value={}||errMsg=exception!",
|
||||
clusterPhyId, host, port, elem.getKey(), elem.getValue(), e
|
||||
);
|
||||
}
|
||||
|
||||
@@ -80,13 +80,13 @@ public class ServerCmdDataParser implements FourLetterWordDataParser<ServerCmdDa
|
||||
break;
|
||||
default:
|
||||
LOGGER.warn(
|
||||
"class=ServerCmdDataParser||method=parseAndInitData||name={}||value={}||msg=data not parsed!",
|
||||
"method=parseAndInitData||name={}||value={}||msg=data not parsed!",
|
||||
elem.getKey(), elem.getValue()
|
||||
);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LOGGER.error(
|
||||
"class=ServerCmdDataParser||method=parseAndInitData||clusterPhyId={}||host={}||port={}||name={}||value={}||errMsg=exception!",
|
||||
"method=parseAndInitData||clusterPhyId={}||host={}||port={}||name={}||value={}||errMsg=exception!",
|
||||
clusterPhyId, host, port, elem.getKey(), elem.getValue(), e
|
||||
);
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ public abstract class BaseExtendFactory {
|
||||
try {
|
||||
handler = doGet(classNamePre, clazz);
|
||||
} catch (NotFindSubclassException e) {
|
||||
LOGGER.error("class=BaseExtendFactory||method=getByClassNamePer||handleNamePre={}||msg={}", classNamePre,
|
||||
LOGGER.error("method=getByClassNamePer||handleNamePre={}||msg={}", classNamePre,
|
||||
e.getMessage());
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ public abstract class BaseExtendFactory {
|
||||
try {
|
||||
beans = SpringTool.getBeansOfType(clazz);
|
||||
} catch (BeansException e) {
|
||||
LOGGER.error("class=BaseExtendFactory||method=findFromSpringContext||handleNamePre={}||msg={}",
|
||||
LOGGER.error("method=findFromSpringContext||handleNamePre={}||msg={}",
|
||||
classNamePre, e.getMessage());
|
||||
}
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ public class RestTemplateConfig {
|
||||
try {
|
||||
traceResponse(request, response, exe, subFlag, beginNano);
|
||||
} catch (Exception e) {
|
||||
SYSTEM_LOGGER.warn("class=LogHttpRequestInterceptor||method=intercept||msg={}", e.getMessage());
|
||||
SYSTEM_LOGGER.warn("method=intercept||msg={}", e.getMessage());
|
||||
}
|
||||
throw new ThirdPartRemoteException("rest-template: " + exe.getMessage(), exe,
|
||||
ResultStatus.HTTP_REQ_ERROR);
|
||||
@@ -98,7 +98,7 @@ public class RestTemplateConfig {
|
||||
}
|
||||
|
||||
private void traceRequest(HttpRequest request, String subFlag, byte[] body) throws IOException {
|
||||
REQ_LOGGER.info("class=LogHttpRequestInterceptor||method=traceRequest||remoteRequest||url={}||method={}||headers={}||body={}||subFlag={}",
|
||||
REQ_LOGGER.info("method=traceRequest||remoteRequest||url={}||method={}||headers={}||body={}||subFlag={}",
|
||||
request.getURI(), request.getMethod(), JSON.toJSONString(request.getHeaders()), new String(body, "UTF-8"), subFlag);
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ public class RestTemplateConfig {
|
||||
StringBuilder inputStringBuilder = new StringBuilder();
|
||||
if (response == null) {
|
||||
RESP_LOGGER.warn(
|
||||
"class=LogHttpRequestInterceptor||method=traceResponse||remoteResponse||code=-1||url={}||text={}||headers={}||body={}||timeCost={}||subFlag={}",
|
||||
"method=traceResponse||remoteResponse||code=-1||url={}||text={}||headers={}||body={}||timeCost={}||subFlag={}",
|
||||
url, null, null, null, (System.nanoTime() - nanoTime) / 1000 / 1000, subFlag);
|
||||
return;
|
||||
}
|
||||
@@ -131,7 +131,7 @@ public class RestTemplateConfig {
|
||||
}
|
||||
} catch (Exception e) {
|
||||
RESP_LOGGER.warn(
|
||||
"class=remoteResponse||code={}||url={}||text={}||headers={}||body={}||error={}||timeCost={}||subFlag={}",
|
||||
"method=traceResponse||code={}||url={}||text={}||headers={}||body={}||error={}||timeCost={}||subFlag={}",
|
||||
response.getStatusCode(), url, response.getStatusText(), response.getHeaders(),
|
||||
inputStringBuilder.toString(), e, (System.nanoTime() - nanoTime) / 1000 / 1000, subFlag);
|
||||
if (!response.getStatusCode().is2xxSuccessful()) {
|
||||
@@ -144,12 +144,12 @@ public class RestTemplateConfig {
|
||||
if (!response.getStatusCode().is2xxSuccessful()) {
|
||||
if (exception == null) {
|
||||
RESP_LOGGER.warn(
|
||||
"class=LogHttpRequestInterceptor||method=traceResponse||remoteResponse||code={}||url={}||text={}||headers={}||body={}||timeCost={}||subFlag={}",
|
||||
"method=traceResponse||remoteResponse||code={}||url={}||text={}||headers={}||body={}||timeCost={}||subFlag={}",
|
||||
response.getStatusCode(), url, response.getStatusText(), response.getHeaders(), responseString,
|
||||
(System.nanoTime() - nanoTime) / 1000 / 1000, subFlag);
|
||||
} else {
|
||||
RESP_LOGGER.warn(
|
||||
"remoteResponse||code={}||url={}||text={}||headers={}||body={}||error={}||timeCost={}||subFlag={}",
|
||||
"method=traceResponse||remoteResponse||code={}||url={}||text={}||headers={}||body={}||error={}||timeCost={}||subFlag={}",
|
||||
response.getStatusCode(), url, response.getStatusText(), response.getHeaders(), responseString,
|
||||
exception, (System.nanoTime() - nanoTime) / 1000 / 1000, subFlag);
|
||||
}
|
||||
@@ -158,12 +158,12 @@ public class RestTemplateConfig {
|
||||
|
||||
if (exception == null) {
|
||||
RESP_LOGGER.info(
|
||||
"class=LogHttpRequestInterceptor||method=traceResponse||remoteResponse||code={}||url={}||text={}||headers={}||responseBody={}||timeCost={}||subFlag={}",
|
||||
"method=traceResponse||remoteResponse||code={}||url={}||text={}||headers={}||responseBody={}||timeCost={}||subFlag={}",
|
||||
response.getStatusCode(), url, response.getStatusText(), response.getHeaders(), responseString,
|
||||
(System.nanoTime() - nanoTime) / 1000 / 1000, subFlag);
|
||||
} else {
|
||||
RESP_LOGGER.warn(
|
||||
"class=LogHttpRequestInterceptor||method=traceResponse||remoteResponse||code={}||url={}||text={}||headers={}||responseBody={}||error={}||timeCost={}||subFlag={}",
|
||||
"method=traceResponse||remoteResponse||code={}||url={}||text={}||headers={}||responseBody={}||error={}||timeCost={}||subFlag={}",
|
||||
response.getStatusCode(), url, response.getStatusText(), response.getHeaders(), responseString,
|
||||
exception, (System.nanoTime() - nanoTime) / 1000 / 1000, subFlag);
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@ public class RestTool {
|
||||
new HttpEntity<>(null, getJsonContentHeaders(headers)), String.class);
|
||||
return JSON.parseObject(result.getBody(), resultType);
|
||||
} catch (Exception e){
|
||||
LOGGER.error("class=RestTool||method=getForObject||url={}||msg=exception!", url, e);
|
||||
LOGGER.error("method=getForObject||url={}||msg=exception!", url, e);
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -151,7 +151,7 @@ public class RestTool {
|
||||
new HttpEntity<>(null, headers), String.class);
|
||||
return JSON.parseObject(result.getBody(), resultType);
|
||||
} catch (Exception e){
|
||||
LOGGER.error("class=RestTool||method=getForObject||url={}||msg=exception!", url, e);
|
||||
LOGGER.error("method=getForObject||url={}||msg=exception!", url, e);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
@@ -4,14 +4,14 @@ public enum VersionItemTypeEnum {
|
||||
/**
|
||||
* 指标
|
||||
*/
|
||||
METRIC_TOPIC(100, "topic_metric"),
|
||||
METRIC_CLUSTER(101, "cluster_metric"),
|
||||
METRIC_GROUP(102, "group_metric"),
|
||||
METRIC_BROKER(103, "broker_metric"),
|
||||
METRIC_PARTITION(104, "partition_metric"),
|
||||
METRIC_REPLICATION(105, "replication_metric"),
|
||||
METRIC_TOPIC(100, "TopicMetric"),
|
||||
METRIC_CLUSTER(101, "ClusterMetric"),
|
||||
METRIC_GROUP(102, "GroupMetric"),
|
||||
METRIC_BROKER(103, "BrokerMetric"),
|
||||
METRIC_PARTITION(104, "PartitionMetric"),
|
||||
METRIC_REPLICATION(105, "ReplicaMetric"),
|
||||
|
||||
METRIC_ZOOKEEPER(110, "zookeeper_metric"),
|
||||
METRIC_ZOOKEEPER(110, "ZookeeperMetric"),
|
||||
|
||||
/**
|
||||
* 服务端查询
|
||||
|
||||
@@ -61,7 +61,7 @@ public class CommonUtils {
|
||||
//转换为16进制
|
||||
return new BigInteger(1, digest).toString(16);
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("class=CommonUtils||method=getMD5||msg=获取文件的md5失败:{}", e.getMessage());
|
||||
LOGGER.error("method=getMD5||msg=获取文件的md5失败:{}", e.getMessage());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -210,7 +210,7 @@ public class ConvertUtil {
|
||||
BeanUtils.copyProperties(srcObj, tgt);
|
||||
consumer.accept(tgt);
|
||||
} catch (Exception e) {
|
||||
LOGGER.warn("class=ConvertUtil||method=obj2Obj||msg={}", e.getMessage());
|
||||
LOGGER.warn("method=obj2Obj||msg={}", e.getMessage());
|
||||
}
|
||||
|
||||
return tgt;
|
||||
@@ -236,7 +236,7 @@ public class ConvertUtil {
|
||||
try {
|
||||
map.put(field.getName(), field.get(obj));
|
||||
} catch (IllegalAccessException e) {
|
||||
LOGGER.warn("class=ConvertUtil||method=Obj2Map||msg={}", e.getMessage(), e);
|
||||
LOGGER.warn("method=Obj2Map||msg={}", e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
return map;
|
||||
@@ -256,7 +256,7 @@ public class ConvertUtil {
|
||||
field.set(obj, map.get(field.getName()));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LOGGER.warn("class=ConvertUtil||method=map2Obj||msg={}", e.getMessage(), e);
|
||||
LOGGER.warn("method=map2Obj||msg={}", e.getMessage(), e);
|
||||
}
|
||||
|
||||
return obj;
|
||||
|
||||
@@ -64,7 +64,7 @@ public class FutureNoWaitUtil<T> {
|
||||
while (true) {
|
||||
FutureTaskDelayQueueData<T> data = null;
|
||||
try {
|
||||
LOGGER.debug("class=FutureNoWaitUtil||method=runCheck||delayQueueSize={}", delayQueueData.size());
|
||||
LOGGER.debug("method=runCheck||delayQueueSize={}", delayQueueData.size());
|
||||
|
||||
while (true) {
|
||||
data = delayQueueData.take();
|
||||
@@ -81,7 +81,7 @@ public class FutureNoWaitUtil<T> {
|
||||
// 停1000ms
|
||||
Thread.sleep(1000);
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("class=FutureNoWaitUtil||method=runCheck||taskName={}||errMsg=exception!", data == null? "": data.getTaskName(), e);
|
||||
LOGGER.error("method=runCheck||taskName={}||errMsg=exception!", data == null? "": data.getTaskName(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,11 +123,11 @@ public class FutureWaitUtil<T> {
|
||||
}
|
||||
|
||||
// 达到超时时间,但是任务未完成,则打印日志并强制取消
|
||||
LOGGER.error("class=FutureUtil||method=waitExecute||taskName={}||msg=cancel task", queueData.getTaskName());
|
||||
LOGGER.error("method=waitExecute||taskName={}||msg=cancel task", queueData.getTaskName());
|
||||
|
||||
queueData.getFutureTask().cancel(true);
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("class=FutureUtil||method=waitExecute||msg=exception", e);
|
||||
LOGGER.error("method=waitExecute||msg=exception", e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -155,7 +155,7 @@ public class FutureWaitUtil<T> {
|
||||
return queueData.getFutureTask().get(stepWaitTimeUnitMs, TimeUnit.MILLISECONDS);
|
||||
} catch (Exception e) {
|
||||
// 达到超时时间,但是任务未完成,则打印日志并强制取消
|
||||
LOGGER.error("class=FutureUtil||method=stepWaitResult||taskName={}||errMsg=exception", queueData.getTaskName(), e);
|
||||
LOGGER.error("method=stepWaitResult||taskName={}||errMsg=exception", queueData.getTaskName(), e);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
@@ -163,7 +163,7 @@ public class PaginationMetricsUtil {
|
||||
try {
|
||||
Field defaultField = FieldUtils.getField(allDataList.get(0).getClass(), defaultSortField, true);
|
||||
if(ValidateUtils.anyNull(defaultField)) {
|
||||
log.debug("class=PaginationMetricsUtil||method=sortMetrics||className={}||metricName={}||defaultFieldName={}||metricSortType={}||msg=default field not exist.",
|
||||
log.debug("method=sortMetrics||className={}||metricName={}||defaultFieldName={}||metricSortType={}||msg=default field not exist.",
|
||||
allDataList.get(0).getClass().getSimpleName(), metricName, defaultSortField, sortType);
|
||||
|
||||
// 字段不存在,则排序失效,直接返回
|
||||
@@ -172,7 +172,7 @@ public class PaginationMetricsUtil {
|
||||
|
||||
Collections.sort(allDataList, (a1, a2) -> sortMetricsObject(a1, a2, metricName, defaultField));
|
||||
} catch (Exception e) {
|
||||
log.debug("class=PaginationMetricsUtil||method=sortMetrics||className={}||metricName={}||defaultFieldName={}||metricSortType={}||errMsg=exception.",
|
||||
log.debug("method=sortMetrics||className={}||metricName={}||defaultFieldName={}||metricSortType={}||errMsg=exception.",
|
||||
allDataList.get(0).getClass().getSimpleName(), metricName, defaultSortField, sortType, e);
|
||||
}
|
||||
|
||||
@@ -214,7 +214,7 @@ public class PaginationMetricsUtil {
|
||||
|
||||
return 0;
|
||||
} catch (Exception e) {
|
||||
log.debug("class=PaginationMetricsUtil||method=sortMetricsObject||metricsA={}||metricsB={}||metricName={}||defaultFieldName={}||errMsg=exception.",
|
||||
log.debug("method=sortMetricsObject||metricsA={}||metricsB={}||metricName={}||defaultFieldName={}||errMsg=exception.",
|
||||
a1, a2, metricName, defaultField.getName(), e);
|
||||
}
|
||||
|
||||
|
||||
@@ -94,12 +94,12 @@ public class RetryExecutor {
|
||||
}
|
||||
} catch (Exception e) {
|
||||
if (!handler.needRetry(e) || tryCount == retryCount) {
|
||||
LOGGER.warn("class=RetryExecutor||method=execute||errMsg={}||handlerName={}||tryCount={}",
|
||||
LOGGER.warn("method=execute||errMsg={}||handlerName={}||tryCount={}",
|
||||
e.getMessage(), name, tryCount, e);
|
||||
throw e;
|
||||
}
|
||||
|
||||
LOGGER.warn("class=RetryExecutor||method=execute||errMsg={}||handlerName={}||tryCount={}||maxTryCount={}",
|
||||
LOGGER.warn("method=execute||errMsg={}||handlerName={}||tryCount={}||maxTryCount={}",
|
||||
e.getMessage(), name, tryCount,retryCount);
|
||||
}
|
||||
} while (tryCount++ < retryCount);
|
||||
|
||||
@@ -56,7 +56,7 @@ public class FourLetterWordUtil {
|
||||
return Result.buildSuc(dataParser.parseAndInitData(clusterPhyId, host, port, cmdData));
|
||||
} catch (Exception e) {
|
||||
LOGGER.error(
|
||||
"class=FourLetterWordUtil||method=executeFourLetterCmd||clusterPhyId={}||host={}||port={}||cmd={}||secure={}||timeout={}||errMsg=exception!",
|
||||
"method=executeFourLetterCmd||clusterPhyId={}||host={}||port={}||cmd={}||secure={}||timeout={}||errMsg=exception!",
|
||||
clusterPhyId, host, port, dataParser.getCmd(), secure, timeout, e
|
||||
);
|
||||
|
||||
@@ -124,7 +124,7 @@ public class FourLetterWordUtil {
|
||||
outputStream.close();
|
||||
} catch (IOException e) {
|
||||
LOGGER.error(
|
||||
"class=FourLetterWordUtil||method=send4LetterWord||clusterPhyId={}||host={}||port={}||cmd={}||secure={}||timeout={}||errMsg=exception!",
|
||||
"method=send4LetterWord||clusterPhyId={}||host={}||port={}||cmd={}||secure={}||timeout={}||errMsg=exception!",
|
||||
host, port, cmd, secure, timeout, e
|
||||
);
|
||||
}
|
||||
@@ -135,7 +135,7 @@ public class FourLetterWordUtil {
|
||||
bufferedReader.close();
|
||||
} catch (IOException e) {
|
||||
LOGGER.error(
|
||||
"class=FourLetterWordUtil||method=send4LetterWord||host={}||port={}||cmd={}||secure={}||timeout={}||errMsg=exception!",
|
||||
"method=send4LetterWord||host={}||port={}||cmd={}||secure={}||timeout={}||errMsg=exception!",
|
||||
host, port, cmd, secure, timeout, e
|
||||
);
|
||||
}
|
||||
@@ -146,7 +146,7 @@ public class FourLetterWordUtil {
|
||||
socket.close();
|
||||
} catch (IOException e) {
|
||||
LOGGER.error(
|
||||
"class=FourLetterWordUtil||method=send4LetterWord||host={}||port={}||cmd={}||secure={}||timeout={}||errMsg=exception!",
|
||||
"method=send4LetterWord||host={}||port={}||cmd={}||secure={}||timeout={}||errMsg=exception!",
|
||||
host, port, cmd, secure, timeout, e
|
||||
);
|
||||
}
|
||||
|
||||
@@ -43,14 +43,14 @@ public class ZKWatcherManager extends AbstractClusterLoadedChangedHandler {
|
||||
try {
|
||||
FutureUtil.quickStartupFutureUtil.submitTask(
|
||||
() -> {
|
||||
log.debug("class={}||method=scheduledTriggerFlush||clusterPhyId={}||msg=flush task start"
|
||||
log.debug("runClass={}||method=scheduledTriggerFlush||clusterPhyId={}||msg=flush task start"
|
||||
, abstractZKWatcher.getClass().getSimpleName(), clusterPhy.getId());
|
||||
|
||||
long startTime = System.currentTimeMillis();
|
||||
|
||||
abstractZKWatcher.flush(clusterPhy);
|
||||
|
||||
log.info("class={}||method=scheduledTriggerFlush||clusterPhyId={}||costTime={}ms||msg=flush task finished"
|
||||
log.info("runClass={}||method=scheduledTriggerFlush||clusterPhyId={}||costTime={}ms||msg=flush task finished"
|
||||
, abstractZKWatcher.getClass().getSimpleName(), clusterPhy.getId(), System.currentTimeMillis() - startTime);
|
||||
});
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -58,7 +58,7 @@ import static com.xiaojukeji.know.streaming.km.common.enums.version.VersionEnum.
|
||||
*/
|
||||
@Service
|
||||
public class BrokerMetricServiceImpl extends BaseMetricService implements BrokerMetricService {
|
||||
protected static final ILog LOGGER = LogFactory.getLog("METRIC_LOGGER");
|
||||
protected static final ILog LOGGER = LogFactory.getLog(BrokerMetricServiceImpl.class);
|
||||
|
||||
public static final String BROKER_METHOD_DO_NOTHING = "doNothing";
|
||||
public static final String BROKER_METHOD_GET_METRIC_FROM_KAFKA_BY_JMX = "getMetricFromKafkaByJMX";
|
||||
|
||||
@@ -221,7 +221,7 @@ public class GroupMetricServiceImpl extends BaseMetricService implements GroupMe
|
||||
|
||||
return Result.buildSuc(metricsList);
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("class=GroupMetricServiceImpl||method=getLagFromAdminClient||clusterPhyId={}||groupName={}||metrics={}||msg=exception", clusterId, groupName, metric, e);
|
||||
LOGGER.error("method=getLagFromAdminClient||clusterPhyId={}||groupName={}||metrics={}||msg=exception", clusterId, groupName, metric, e);
|
||||
return Result.buildFailure(VC_KAFKA_CLIENT_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@ import com.xiaojukeji.know.streaming.km.common.bean.entity.version.VersionMethod
|
||||
import com.xiaojukeji.know.streaming.km.common.enums.version.VersionEnum;
|
||||
import com.xiaojukeji.know.streaming.km.common.enums.version.VersionItemTypeEnum;
|
||||
import com.xiaojukeji.know.streaming.km.common.exception.VCHandlerNotExistException;
|
||||
import com.xiaojukeji.know.streaming.km.common.utils.EnvUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.DependsOn;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
@@ -25,7 +24,7 @@ import java.util.function.Function;
|
||||
*/
|
||||
@DependsOn("versionControlService")
|
||||
public abstract class BaseVersionControlService {
|
||||
protected static final ILog LOGGER = LogFactory.getLog("METRIC_LOGGER");
|
||||
protected static final ILog LOGGER = LogFactory.getLog(BaseVersionControlService.class);
|
||||
|
||||
@Autowired
|
||||
protected VersionControlService versionControlService;
|
||||
@@ -61,10 +60,11 @@ public abstract class BaseVersionControlService {
|
||||
String methodName = getMethodName(clusterPhyId, action);
|
||||
Object ret = versionControlService.doHandler(getVersionItemType(), methodName, param);
|
||||
|
||||
if(!EnvUtil.isOnline()){
|
||||
LOGGER.info("method=doVCHandler||clusterId={}||action={}||methodName={}||type={}param={}||ret={}}!",
|
||||
clusterPhyId, action, methodName, getVersionItemType().getMessage(), JSON.toJSONString(param), JSON.toJSONString(ret));
|
||||
}
|
||||
LOGGER.debug(
|
||||
"method=doVCHandler||clusterId={}||action={}||methodName={}||type={}param={}||ret={}!",
|
||||
clusterPhyId, action, methodName, getVersionItemType().getMessage(), JSON.toJSONString(param), JSON.toJSONString(ret)
|
||||
);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.xiaojukeji.know.streaming.km.persistence.es;
|
||||
|
||||
import com.didiglobal.logi.log.ILog;
|
||||
import com.didiglobal.logi.log.LogFactory;
|
||||
import com.xiaojukeji.know.streaming.km.common.utils.LoggerUtil;
|
||||
import com.xiaojukeji.know.streaming.km.persistence.es.dsls.DslLoaderUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
@@ -9,7 +9,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
* 直接操作es集群的dao
|
||||
*/
|
||||
public abstract class BaseESDAO {
|
||||
protected static final ILog LOGGER = LogFactory.getLog("ES_LOGGER");
|
||||
protected static final ILog LOGGER = LoggerUtil.getESLogger();
|
||||
|
||||
/**
|
||||
* 加载查询语句工具类
|
||||
|
||||
@@ -65,7 +65,7 @@ public class BaseMetricESDAO extends BaseESDAO {
|
||||
|
||||
esOpClient.createIndex(realIndex);
|
||||
}
|
||||
}catch (Exception e){
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("method=checkCurrentDayIndexExist||errMsg=exception!", e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ public class ZookeeperMetricESDAO extends BaseMetricESDAO {
|
||||
ESConstant.DEFAULT_RETRY_TIME
|
||||
);
|
||||
} catch (Exception e){
|
||||
LOGGER.error("class=ZookeeperMetricESDAO||method=listMetricsByClusterPhyId||clusterPhyId={}||errMsg=exception!",
|
||||
LOGGER.error("method=listMetricsByClusterPhyId||clusterPhyId={}||errMsg=exception!",
|
||||
clusterPhyId, e
|
||||
);
|
||||
}
|
||||
|
||||
@@ -7,10 +7,10 @@ import com.alibaba.fastjson.parser.Feature;
|
||||
import com.alibaba.fastjson.parser.ParserConfig;
|
||||
import com.alibaba.fastjson.serializer.SerializerFeature;
|
||||
import com.didiglobal.logi.log.ILog;
|
||||
import com.didiglobal.logi.log.LogFactory;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.xiaojukeji.know.streaming.km.common.utils.EnvUtil;
|
||||
import com.xiaojukeji.know.streaming.km.common.utils.LoggerUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -34,7 +34,7 @@ import java.util.Map;
|
||||
*/
|
||||
@Component
|
||||
public class DslLoaderUtil {
|
||||
private static final ILog LOGGER = LogFactory.getLog("ES_LOGGER");
|
||||
private static final ILog LOGGER = LoggerUtil.getESLogger();
|
||||
/**
|
||||
* 查询语句容器
|
||||
*/
|
||||
@@ -42,7 +42,7 @@ public class DslLoaderUtil {
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
LOGGER.info("class=DslLoaderUtil||method=init||DslLoaderUtil init start.");
|
||||
LOGGER.info("method=init||DslLoaderUtil init start.");
|
||||
List<String> dslFileNames = Lists.newLinkedList();
|
||||
|
||||
// 反射获取接口中定义的变量中的值
|
||||
@@ -52,7 +52,7 @@ public class DslLoaderUtil {
|
||||
try {
|
||||
dslFileNames.add(fields[i].get(null).toString());
|
||||
} catch (IllegalAccessException e) {
|
||||
LOGGER.error("class=DslLoaderUtil||method=init||errMsg=fail to read {} error. ", fields[i].getName(),
|
||||
LOGGER.error("method=init||errMsg=fail to read {} error. ", fields[i].getName(),
|
||||
e);
|
||||
}
|
||||
}
|
||||
@@ -63,13 +63,13 @@ public class DslLoaderUtil {
|
||||
}
|
||||
|
||||
// 输出加载的查询语句
|
||||
LOGGER.info("class=DslLoaderUtil||method=init||msg=dsl files count {}", dslsMap.size());
|
||||
LOGGER.info("method=init||msg=dsl files count {}", dslsMap.size());
|
||||
for (Map.Entry<String/*fileRelativePath*/, String/*dslContent*/> entry : dslsMap.entrySet()) {
|
||||
LOGGER.info("class=DslLoaderUtil||method=init||msg=file name {}, dsl content {}", entry.getKey(),
|
||||
LOGGER.info("method=init||msg=file name {}, dsl content {}", entry.getKey(),
|
||||
entry.getValue());
|
||||
}
|
||||
|
||||
LOGGER.info("class=DslLoaderUtil||method=init||DslLoaderUtil init finished.");
|
||||
LOGGER.info("method=init||DslLoaderUtil init finished.");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -93,7 +93,7 @@ public class DslLoaderUtil {
|
||||
String loadDslContent = getDslByFileName(fileName);
|
||||
|
||||
if (StringUtils.isBlank(loadDslContent)) {
|
||||
LOGGER.error("class=DslLoaderUtil||method=getFormatDslByFileName||errMsg=dsl file {} content is empty",
|
||||
LOGGER.error("method=getFormatDslByFileName||errMsg=dsl file {} content is empty",
|
||||
fileName);
|
||||
return "";
|
||||
}
|
||||
@@ -102,7 +102,7 @@ public class DslLoaderUtil {
|
||||
String dsl = trimJsonBank( String.format(loadDslContent, args));
|
||||
// 如果不是线上环境,则输出dsl语句
|
||||
if (!EnvUtil.isOnline()) {
|
||||
LOGGER.info("class=DslLoaderUtil||method=getFormatDslByFileName||dsl={}", dsl);
|
||||
LOGGER.info("method=getFormatDslByFileName||dsl={}", dsl);
|
||||
}
|
||||
|
||||
return dsl;
|
||||
@@ -164,7 +164,7 @@ public class DslLoaderUtil {
|
||||
JSON.DEFAULT_PARSER_FEATURE | Feature.OrderedField.getMask());
|
||||
obj = parser.parse();
|
||||
} catch (Exception t) {
|
||||
LOGGER.error("class=DslLoaderUtil||method=trimJsonBank||errMsg=parse json {} error. ", dsl, t);
|
||||
LOGGER.error("method=trimJsonBank||errMsg=parse json {} error. ", dsl, t);
|
||||
}
|
||||
if (obj == null) {
|
||||
break;
|
||||
@@ -212,7 +212,7 @@ public class DslLoaderUtil {
|
||||
return StringUtils.join(lines, "");
|
||||
|
||||
} catch (IOException e) {
|
||||
LOGGER.error("class=DslLoaderUtil||method=readDslFileInJarFile||errMsg=read file {} error. ", fileName,
|
||||
LOGGER.error("method=readDslFileInJarFile||errMsg=read file {} error. ", fileName,
|
||||
e);
|
||||
|
||||
return "";
|
||||
@@ -221,12 +221,12 @@ public class DslLoaderUtil {
|
||||
inputStream.close();
|
||||
} catch (IOException e) {
|
||||
LOGGER.error(
|
||||
"class=DslLoaderUtil||method=readDslFileInJarFile||errMsg=fail to close file {} error. ",
|
||||
"method=readDslFileInJarFile||errMsg=fail to close file {} error. ",
|
||||
fileName, e);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
LOGGER.error("class=DslLoaderUtil||method=readDslFileInJarFile||errMsg=fail to read file {} content",
|
||||
LOGGER.error("method=readDslFileInJarFile||errMsg=fail to read file {} content",
|
||||
fileName);
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ public class JmxDAOImpl implements JmxDAO {
|
||||
return object == null? null: (Long) object;
|
||||
} catch (Exception e) {
|
||||
log.error(
|
||||
"class=JmxDAOImpl||method=getServerStartTime||clusterPhyId={}||jmxHost={}||jmxPort={}||jmxConfig={}||errMsg=exception!",
|
||||
"method=getServerStartTime||clusterPhyId={}||jmxHost={}||jmxPort={}||jmxConfig={}||errMsg=exception!",
|
||||
clusterPhyId, jmxHost, jmxPort, jmxConfig, e
|
||||
);
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ public class PermissionInterceptor implements HandlerInterceptor {
|
||||
classRequestMappingValue = getClassRequestMappingValue(handler);
|
||||
} catch (Exception e) {
|
||||
LOGGER.error(
|
||||
"class=PermissionInterceptor||method=preHandle||uri={}||msg=parse class request-mapping failed",
|
||||
"method=preHandle||uri={}||msg=parse class request-mapping failed",
|
||||
request.getRequestURI(), e);
|
||||
}
|
||||
|
||||
|
||||
@@ -31,12 +31,12 @@ public abstract class AbstractAsyncCommonDispatchTask extends AbstractClusterPhy
|
||||
try {
|
||||
TaskResult tr = this.processClusterTask(clusterPhy, triggerTimeUnitMs);
|
||||
if (TaskResult.SUCCESS_CODE != tr.getCode()) {
|
||||
log.error("class=AbstractAsyncCommonDispatchTask||taskName={}||clusterPhyId={}||taskResult={}||msg=failed", this.taskName, clusterPhy.getId(), tr);
|
||||
log.error("method=asyncProcessSubTask||taskName={}||clusterPhyId={}||taskResult={}||msg=failed", this.taskName, clusterPhy.getId(), tr);
|
||||
} else {
|
||||
log.debug("class=AbstractAsyncCommonDispatchTask||taskName={}||clusterPhyId={}||msg=success", this.taskName, clusterPhy.getId());
|
||||
log.debug("method=asyncProcessSubTask||taskName={}||clusterPhyId={}||msg=success", this.taskName, clusterPhy.getId());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("class=AbstractAsyncCommonDispatchTask||taskName={}||clusterPhyId={}||errMsg=exception", this.taskName, clusterPhy.getId(), e);
|
||||
log.error("method=asyncProcessSubTask||taskName={}||clusterPhyId={}||errMsg=exception", this.taskName, clusterPhy.getId(), e);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
@@ -35,7 +35,7 @@ public class CommunityReassignJobTask extends AbstractAsyncCommonDispatchTask {
|
||||
// 更新任务的状态
|
||||
Result<Void> rv = reassignJobService.verifyAndUpdateStatue(jobId);
|
||||
if (rv != null && rv.failed()) {
|
||||
log.error("class=CommunityReassignJobTask||method=processSubTask||jobId={}||result={}||msg=verify and update task status failed", jobId, rv);
|
||||
log.error("method=processSubTask||jobId={}||result={}||msg=verify and update task status failed", jobId, rv);
|
||||
}
|
||||
|
||||
// 更新同步进度信息
|
||||
|
||||
@@ -32,12 +32,12 @@ public abstract class AbstractAsyncMetadataDispatchTask extends AbstractClusterP
|
||||
try {
|
||||
TaskResult tr = this.processClusterTask(clusterPhy, triggerTimeUnitMs);
|
||||
if (TaskResult.SUCCESS_CODE != tr.getCode()) {
|
||||
log.error("class=AbstractAsyncMetadataDispatchTask||taskName={}||clusterPhyId={}||taskResult={}||msg=failed", this.taskName, clusterPhy.getId(), tr);
|
||||
log.error("method=asyncProcessSubTask||taskName={}||clusterPhyId={}||taskResult={}||msg=failed", this.taskName, clusterPhy.getId(), tr);
|
||||
} else {
|
||||
log.debug("class=AbstractAsyncMetadataDispatchTask||taskName={}||clusterPhyId={}||msg=success", this.taskName, clusterPhy.getId());
|
||||
log.debug("method=asyncProcessSubTask||taskName={}||clusterPhyId={}||msg=success", this.taskName, clusterPhy.getId());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("class=AbstractAsyncMetadataDispatchTask||taskName={}||clusterPhyId={}||errMsg=exception", this.taskName, clusterPhy.getId(), e);
|
||||
log.error("method=asyncProcessSubTask||taskName={}||clusterPhyId={}||errMsg=exception", this.taskName, clusterPhy.getId(), e);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
@@ -49,7 +49,7 @@ public class SyncPartitionTask extends AbstractAsyncMetadataDispatchTask {
|
||||
try {
|
||||
partitionService.updatePartitions(clusterPhy.getId(), entry.getKey(), entry.getValue(), dbPartitionMap.getOrDefault(entry.getKey(), new ArrayList<>()));
|
||||
} catch (Exception e) {
|
||||
log.error("class=SyncPartitionTask||method=processSubTask||clusterPhyId={}||topicName={}||errMsg=exception", clusterPhy.getId(), entry.getKey(), e);
|
||||
log.error("method=processSubTask||clusterPhyId={}||topicName={}||errMsg=exception", clusterPhy.getId(), entry.getKey(), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -32,12 +32,12 @@ public abstract class AbstractAsyncMetricsDispatchTask extends AbstractClusterPh
|
||||
try {
|
||||
TaskResult tr = this.processClusterTask(clusterPhy, triggerTimeUnitMs);
|
||||
if (TaskResult.SUCCESS_CODE != tr.getCode()) {
|
||||
log.error("class=AbstractAsyncMetricsDispatchTask||taskName={}||clusterPhyId={}||taskResult={}||msg=failed", this.taskName, clusterPhy.getId(), tr);
|
||||
log.error("method=asyncProcessSubTask||taskName={}||clusterPhyId={}||taskResult={}||msg=failed", this.taskName, clusterPhy.getId(), tr);
|
||||
} else {
|
||||
log.debug("class=AbstractAsyncMetricsDispatchTask||taskName={}||clusterPhyId={}||msg=success", this.taskName, clusterPhy.getId());
|
||||
log.debug("method=asyncProcessSubTask||taskName={}||clusterPhyId={}||msg=success", this.taskName, clusterPhy.getId());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("class=AbstractAsyncMetricsDispatchTask||taskName={}||clusterPhyId={}||errMsg=exception", this.taskName, clusterPhy.getId(), e);
|
||||
log.error("method=asyncProcessSubTask||taskName={}||clusterPhyId={}||errMsg=exception", this.taskName, clusterPhy.getId(), e);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user