mirror of
https://github.com/PowerJob/PowerJob.git
synced 2025-07-17 00:00:04 +08:00
[opt] system log and almost to release
This commit is contained in:
parent
010eb92f57
commit
c7a105db29
@ -15,7 +15,6 @@ import com.github.kfcfans.oms.server.common.constans.InstanceType;
|
||||
import com.github.kfcfans.oms.server.persistence.core.model.InstanceInfoDO;
|
||||
import com.github.kfcfans.oms.server.persistence.core.repository.InstanceInfoRepository;
|
||||
import com.github.kfcfans.oms.server.service.id.IdGenerateService;
|
||||
import com.github.kfcfans.oms.server.service.workflow.WorkflowInstanceService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -42,8 +41,6 @@ public class InstanceService {
|
||||
@Resource
|
||||
private IdGenerateService idGenerateService;
|
||||
@Resource
|
||||
private WorkflowInstanceService workflowInstanceService;
|
||||
@Resource
|
||||
private InstanceInfoRepository instanceInfoRepository;
|
||||
|
||||
/**
|
||||
@ -114,12 +111,12 @@ public class InstanceService {
|
||||
ServerStopInstanceReq req = new ServerStopInstanceReq(instanceId);
|
||||
taskTrackerActor.tell(req, null);
|
||||
|
||||
log.info("[InstanceService-{}] update instance log and send request succeed.", instanceId);
|
||||
log.info("[Instance-{}] update instanceInfo and send request succeed.", instanceId);
|
||||
|
||||
}catch (IllegalArgumentException ie) {
|
||||
throw ie;
|
||||
}catch (Exception e) {
|
||||
log.error("[InstanceService-{}] stopInstance failed.", instanceId, e);
|
||||
log.error("[Instance-{}] stopInstance failed.", instanceId, e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
@ -132,7 +129,7 @@ public class InstanceService {
|
||||
public InstanceInfoDTO getInstanceInfo(Long instanceId) {
|
||||
InstanceInfoDO instanceInfoDO = instanceInfoRepository.findByInstanceId(instanceId);
|
||||
if (instanceInfoDO == null) {
|
||||
log.warn("[InstanceService] can't find execute log for instanceId: {}.", instanceId);
|
||||
log.warn("[Instance-{}] can't find InstanceInfo by instanceId.", instanceId);
|
||||
throw new IllegalArgumentException("invalid instanceId: " + instanceId);
|
||||
}
|
||||
InstanceInfoDTO instanceInfoDTO = new InstanceInfoDTO();
|
||||
@ -148,7 +145,7 @@ public class InstanceService {
|
||||
public InstanceStatus getInstanceStatus(Long instanceId) {
|
||||
InstanceInfoDO instanceInfoDO = instanceInfoRepository.findByInstanceId(instanceId);
|
||||
if (instanceInfoDO == null) {
|
||||
log.warn("[InstanceService] can't find execute log for instanceId: {}.", instanceId);
|
||||
log.warn("[Instance-{}] can't find InstanceInfo by instanceId.", instanceId);
|
||||
throw new IllegalArgumentException("invalid instanceId: " + instanceId);
|
||||
}
|
||||
return InstanceStatus.of(instanceInfoDO.getStatus());
|
||||
@ -163,7 +160,7 @@ public class InstanceService {
|
||||
|
||||
InstanceInfoDO instanceInfoDO = instanceInfoRepository.findByInstanceId(instanceId);
|
||||
if (instanceInfoDO == null) {
|
||||
log.warn("[InstanceService] can't find execute log for instanceId: {}.", instanceId);
|
||||
log.warn("[Instance-{}] can't find InstanceInfo by instanceId", instanceId);
|
||||
throw new IllegalArgumentException("invalid instanceId: " + instanceId);
|
||||
}
|
||||
|
||||
@ -190,11 +187,11 @@ public class InstanceService {
|
||||
instanceDetail.setRunningTimes(instanceInfoDO.getRunningTimes());
|
||||
return instanceDetail;
|
||||
}else {
|
||||
log.warn("[InstanceService] ask InstanceStatus from TaskTracker failed, the message is {}.", askResponse.getMessage());
|
||||
log.warn("[Instance-{}] ask InstanceStatus from TaskTracker failed, the message is {}.", instanceId, askResponse.getMessage());
|
||||
}
|
||||
|
||||
}catch (Exception e) {
|
||||
log.error("[InstanceService] ask InstanceStatus from TaskTracker failed.", e);
|
||||
log.error("[Instance-{}] ask InstanceStatus from TaskTracker failed, exception is {}", instanceId, e.toString());
|
||||
}
|
||||
|
||||
// 失败则返回基础版信息
|
||||
|
@ -3,6 +3,8 @@ package com.github.kfcfans.oms.server.web;
|
||||
import com.github.kfcfans.oms.common.OmsException;
|
||||
import com.github.kfcfans.oms.common.response.ResultDTO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.http.converter.HttpMessageNotReadableException;
|
||||
import org.springframework.messaging.handler.annotation.support.MethodArgumentTypeMismatchException;
|
||||
import org.springframework.web.bind.annotation.ControllerAdvice;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
@ -24,7 +26,9 @@ public class ControllerExceptionHandler {
|
||||
// 不是所有异常都需要打印完整堆栈,后续可以定义内部的Exception,便于判断
|
||||
if (e instanceof IllegalArgumentException || e instanceof OmsException) {
|
||||
log.warn("[ControllerException] http request failed, message is {}.", e.getMessage());
|
||||
}else {
|
||||
} else if (e instanceof HttpMessageNotReadableException || e instanceof MethodArgumentTypeMismatchException) {
|
||||
log.warn("[ControllerException] invalid http request params, exception is {}.", e.getMessage());
|
||||
} else {
|
||||
log.error("[ControllerException] http request failed.", e);
|
||||
}
|
||||
return ResultDTO.failed(e.getMessage());
|
||||
|
@ -85,7 +85,7 @@ public class SystemInfoController {
|
||||
}
|
||||
return ResultDTO.failed(askResponse.getMessage());
|
||||
}catch (Exception e) {
|
||||
log.error("[SystemInfoController] listWorker for appId:{} failed.", appId, e);
|
||||
log.error("[SystemInfoController] listWorker for appId:{} failed, exception is {}", appId, e.toString());
|
||||
return ResultDTO.failed("no worker or server available");
|
||||
}
|
||||
}
|
||||
|
@ -35,7 +35,7 @@
|
||||
<MaxHistory>7</MaxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level - %msg%n</pattern>
|
||||
<charset>UTF-8</charset>
|
||||
</encoder>
|
||||
<append>true</append>
|
||||
|
@ -67,7 +67,7 @@ public class OmsContainerFactory {
|
||||
deployContainer(deployRequest);
|
||||
}
|
||||
}catch (Exception e) {
|
||||
log.error("[OmsContainer-{}] deployed container failed.", containerId, e);
|
||||
log.error("[OmsContainer-{}] deployed container failed, exception is {}", containerId, e.toString());
|
||||
}
|
||||
|
||||
return CARGO.get(containerId);
|
||||
|
@ -61,7 +61,7 @@ public abstract class MapProcessor implements BasicProcessor {
|
||||
AskResponse respObj = (AskResponse) requestCS.toCompletableFuture().get(REQUEST_TIMEOUT_MS, TimeUnit.MILLISECONDS);
|
||||
requestSucceed = respObj.isSuccess();
|
||||
}catch (Exception e) {
|
||||
log.warn("[MapProcessor] map failed.", e);
|
||||
log.warn("[MapProcessor] map failed, exception is {}.", e.toString());
|
||||
}
|
||||
|
||||
if (requestSucceed) {
|
||||
|
@ -226,7 +226,7 @@ public class CommonTaskTracker extends TaskTracker {
|
||||
try {
|
||||
AskResponse askResponse = (AskResponse) askCS.toCompletableFuture().get(RemoteConstant.DEFAULT_TIMEOUT_MS, TimeUnit.MILLISECONDS);
|
||||
serverAccepted = askResponse.isSuccess();
|
||||
}catch (Exception e) {
|
||||
}catch (Exception ignore) {
|
||||
log.warn("[TaskTracker-{}] report finished status failed, result={}.", instanceId, result);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user