Commit 924de713 by huangfusuper

异常信息

parent d0cf908a
...@@ -246,6 +246,7 @@ public class ApiFlowServiceImpl implements ApiFlowService { ...@@ -246,6 +246,7 @@ public class ApiFlowServiceImpl implements ApiFlowService {
for(PluginBaseNode pluginNode : nodeList){ for(PluginBaseNode pluginNode : nodeList){
Node node = new Node(); Node node = new Node();
buildNode(pluginNode, flow, node); buildNode(pluginNode, flow, node);
node.setNodeId(null);
Integer nodeId = nodeMapper.insertSelective(node); Integer nodeId = nodeMapper.insertSelective(node);
nameIdRel.put(node.getNodeName(), node.getNodeId()); nameIdRel.put(node.getNodeName(), node.getNodeId());
} }
......
package com.byit.factory; package com.byit.factory;
import com.byit.thread.BaseThreadRunHelper; import com.byit.thread.BaseThreadRunHelper;
import com.byit.util.MythLogUtils;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression; import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
import org.springframework.context.annotation.Primary; import org.springframework.context.annotation.Primary;
...@@ -71,7 +72,7 @@ public class DaemonScanThreadRunHelperDbLock extends BaseDaemonScanThreadRunHelp ...@@ -71,7 +72,7 @@ public class DaemonScanThreadRunHelperDbLock extends BaseDaemonScanThreadRunHelp
sleepTime = examplesValue.start(); sleepTime = examplesValue.start();
}catch (Exception e){ }catch (Exception e){
if(!THREAD_GROUP_STOP){ if(!THREAD_GROUP_STOP){
e.printStackTrace(); log.error("-----{}-----", MythLogUtils.getMessage(e));
} }
}finally { }finally {
......
package com.byit.factory; package com.byit.factory;
import com.byit.thread.BaseThreadRunHelper; import com.byit.thread.BaseThreadRunHelper;
import com.byit.util.MythLogUtils;
import com.byit.util.lock.RedissLockUtil; import com.byit.util.lock.RedissLockUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression; import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
...@@ -52,7 +53,7 @@ public class DaemonScanThreadRunHelperRedisLock extends BaseDaemonScanThreadRunH ...@@ -52,7 +53,7 @@ public class DaemonScanThreadRunHelperRedisLock extends BaseDaemonScanThreadRunH
}catch (Exception e) { }catch (Exception e) {
RedissLockUtil.unlock(lockName); RedissLockUtil.unlock(lockName);
if(!THREAD_GROUP_STOP){ if(!THREAD_GROUP_STOP){
log.error("---------{}---------",e.getMessage()); log.error("---------{}---------", MythLogUtils.getMessage(e));
} }
} }
sleepTime = sleepTime==null || sleepTime<=0?examplesValue.UNIVERSAL_WAIT_TIME:sleepTime; sleepTime = sleepTime==null || sleepTime<=0?examplesValue.UNIVERSAL_WAIT_TIME:sleepTime;
......
...@@ -14,6 +14,7 @@ import com.byit.service.FastRunLogService; ...@@ -14,6 +14,7 @@ import com.byit.service.FastRunLogService;
import com.byit.service.FlowStatusService; import com.byit.service.FlowStatusService;
import com.byit.service.impl.JobTaskRunLogServiceImpl; import com.byit.service.impl.JobTaskRunLogServiceImpl;
import com.byit.service.impl.RunJavaServiceImpl; import com.byit.service.impl.RunJavaServiceImpl;
import com.byit.util.MythLogUtils;
import com.byit.util.ServiceInfoUtil; import com.byit.util.ServiceInfoUtil;
import com.byit.util.SpringUtil; import com.byit.util.SpringUtil;
import io.netty.util.Timeout; import io.netty.util.Timeout;
...@@ -101,17 +102,18 @@ public class JavaNodeExecutorTask implements TimerTask { ...@@ -101,17 +102,18 @@ public class JavaNodeExecutorTask implements TimerTask {
}catch (Exception e){ }catch (Exception e){
if (mythJobTaskSchedule.getScheduleType().equals(4)) { if (mythJobTaskSchedule.getScheduleType().equals(4)) {
StringRedisTemplate stringRedisTemplate = (StringRedisTemplate) SpringUtil.getBean("stringRedisTemplate"); StringRedisTemplate stringRedisTemplate = (StringRedisTemplate) SpringUtil.getBean("stringRedisTemplate");
RunLog runLog = RunLog.builder().isEnd(true).isSuccess(false).runLog("执行资源异常" + e.getMessage()).build(); RunLog runLog = RunLog.builder().isEnd(true).isSuccess(false).runLog("执行资源异常" + MythLogUtils.getMessage(e)).build();
//stringRedisTemplate.convertAndSend("REAL:EXEC:" + mythJobTaskSchedule.getLogId() , JSON.toJSONString(runLog, WriteClassName)); //stringRedisTemplate.convertAndSend("REAL:EXEC:" + mythJobTaskSchedule.getLogId() , JSON.toJSONString(runLog, WriteClassName));
//使用redis 想队尾push一个值 //使用redis 想队尾push一个值
stringRedisTemplate.opsForList().rightPush("REAL:EXEC:" + mythJobTaskSchedule.getLogId() , JSON.toJSONString(runLog, WriteClassName)); stringRedisTemplate.opsForList().rightPush("REAL:EXEC:" + mythJobTaskSchedule.getLogId() , JSON.toJSONString(runLog, WriteClassName));
} }
log.error("------执行机异常{}-----", e.getMessage()); log.error("------执行机异常{}-----", MythLogUtils.getMessage(e));
assert jobTaskRunLogById != null;
jobTaskRunLogById.setTriggerCode(RunResultEnum.TRIGGER_ERROR.getCode()); jobTaskRunLogById.setTriggerCode(RunResultEnum.TRIGGER_ERROR.getCode());
jobTaskRunLogById.setRunCode(RunResultEnum.RUN_ERROR.getCode()); jobTaskRunLogById.setRunCode(RunResultEnum.RUN_ERROR.getCode());
jobTaskRunLogById.setRunMsg(mythJobTaskSchedule.getNodeName()+":"+e.getMessage()); jobTaskRunLogById.setRunMsg(mythJobTaskSchedule.getNodeName()+":"+MythLogUtils.getMessage(e));
jobTaskRunLogById.setTriggerMsg(mythJobTaskSchedule.getNodeName()+":"+e.getMessage()); jobTaskRunLogById.setTriggerMsg(mythJobTaskSchedule.getNodeName()+":"+MythLogUtils.getMessage(e));
} }
jobTaskRunLogService.updateJobTaskRunLogWithBLOBs(jobTaskRunLogById); jobTaskRunLogService.updateJobTaskRunLogWithBLOBs(jobTaskRunLogById);
......
package com.byit.util;
import java.io.PrintWriter;
import java.io.StringWriter;
/**
* @author huangfu
*/
public class MythLogUtils {
/**
* 读取异常信息
* @param obj 异常对象
* @return 返回堆栈异常信息
*/
public static String getMessage(Object obj) {
if (obj == null) {
return "";
}
if (obj instanceof Throwable) {
StringWriter str = new StringWriter();
PrintWriter pw = new PrintWriter(str);
((Throwable) obj).printStackTrace(pw);
return str.toString();
} else {
return obj.toString();
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment