[Optimize]日志统一格式&优化输出内容-part3(#800)

This commit is contained in:
zengqiao
2022-12-02 15:14:21 +08:00
parent 7a52cf67b0
commit fab41e892f
30 changed files with 84 additions and 84 deletions

View File

@@ -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) {

View File

@@ -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";

View File

@@ -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);
}
}

View File

@@ -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;
}