Commit 4554b8d3 by huangfusuper

日志合并

parent c1c0baaa
...@@ -6,6 +6,7 @@ import com.byit.dto.web.ReturnResult; ...@@ -6,6 +6,7 @@ import com.byit.dto.web.ReturnResult;
import com.byit.enums.JobResultEnum; import com.byit.enums.JobResultEnum;
import com.byit.enums.task.RunResultEnum; import com.byit.enums.task.RunResultEnum;
import com.byit.filesystem.FileSystem; import com.byit.filesystem.FileSystem;
import com.byit.job.utils.DateUtil;
import com.byit.model.JobTaskRunLogWithBLOBs; import com.byit.model.JobTaskRunLogWithBLOBs;
import com.byit.model.RunRecording; import com.byit.model.RunRecording;
import com.byit.model.Workspace; import com.byit.model.Workspace;
...@@ -133,9 +134,15 @@ public class JavaFlowFreeTaskCallbackThread implements Runnable { ...@@ -133,9 +134,15 @@ public class JavaFlowFreeTaskCallbackThread implements Runnable {
if(StringUtils.isBlank(logRemotelyPath)) { if(StringUtils.isBlank(logRemotelyPath)) {
FileSystem fileSystem = SpringUtil.getBean(FileSystem.class); FileSystem fileSystem = SpringUtil.getBean(FileSystem.class);
byte[] sourceLogBytes = fileSystem.downloaderFile(thisLogUrlPath); byte[] sourceLogBytes = fileSystem.downloaderFile(thisLogUrlPath);
//间隔日志
String interval = "\n\n\n 游离节点日志,时间:"+ DateUtil.dateFormat(new Date(),"yyyy-MM-dd HH:mm:ss")+"\n";
byte[] intervalByte = stringToByteArray(interval);
byte[] intervalByteMergeFile = mergeFile(intervalByte,sourceLogBytes);
//间隔日志
String runMsg = jobTaskRunLogWithBLOBs.getRunMsg(); String runMsg = jobTaskRunLogWithBLOBs.getRunMsg();
byte[] bytes = stringToByteArray(runMsg); byte[] bytes = stringToByteArray(runMsg);
byte[] mergeFile = mergeFile(sourceLogBytes, bytes); byte[] mergeFile = mergeFile(intervalByteMergeFile, bytes);
Map<String, String> fileMate = fileSystem.getFileMate(thisLogUrlPath); Map<String, String> fileMate = fileSystem.getFileMate(thisLogUrlPath);
String logPath = fileSystem.uploadFile(mergeFile, "log", fileMate); String logPath = fileSystem.uploadFile(mergeFile, "log", fileMate);
jobTaskRunLogWithBLOBs.setLogRemotelyPath(logPath); jobTaskRunLogWithBLOBs.setLogRemotelyPath(logPath);
...@@ -152,7 +159,7 @@ public class JavaFlowFreeTaskCallbackThread implements Runnable { ...@@ -152,7 +159,7 @@ public class JavaFlowFreeTaskCallbackThread implements Runnable {
public String mergeLog(String sourceLogPath,String targetLogPath) throws IOException { public String mergeLog(String sourceLogPath,String targetLogPath) throws IOException {
FileSystem fileSystem = SpringUtil.getBean(FileSystem.class); FileSystem fileSystem = SpringUtil.getBean(FileSystem.class);
byte[] sourceLogBytes = fileSystem.downloaderFile(sourceLogPath); byte[] sourceLogBytes = fileSystem.downloaderFile(sourceLogPath);
String interval = "\n\n\n 游离节点日志\n"; String interval = "\n\n\n 游离节点日志,时间:"+ DateUtil.dateFormat(new Date(),"yyyy-MM-dd HH:mm:ss")+"\n";
byte[] intervalByte = stringToByteArray(interval); byte[] intervalByte = stringToByteArray(interval);
sourceLogBytes = mergeFile(sourceLogBytes, intervalByte); sourceLogBytes = mergeFile(sourceLogBytes, intervalByte);
byte[] targetLogBytes = fileSystem.downloaderFile(targetLogPath); byte[] targetLogBytes = fileSystem.downloaderFile(targetLogPath);
......
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