Commit c5502c2f by huangfusuper

取消显示日志的详细信息,改为显示远程路径

parent 56be6a67
......@@ -56,6 +56,7 @@ myth-job:
fdfs:
so-timeout: 1500
http-port: 88
connect-timeout: 600
pool:
jmx-enabled: false
......
......@@ -60,6 +60,7 @@ myth-job:
fdfs:
so-timeout: 1500
connect-timeout: 600
http-port: 88
pool:
jmx-enabled: false
tracker-list:
......
......@@ -56,6 +56,7 @@ myth-job:
fdfs:
so-timeout: 1500
connect-timeout: 600
http-port: 8888
pool:
jmx-enabled: false
tracker-list:
......
......@@ -57,6 +57,7 @@ myth-job:
fdfs:
so-timeout: 1500
connect-timeout: 600
http-port: 8888
pool:
jmx-enabled: false
tracker-list:
......
......@@ -2,7 +2,6 @@ package com.byit.service.mapservice.impl;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUtil;
import com.byit.filesystem.FileSystem;
import com.byit.model.EmailAlarm;
import com.byit.model.JobTaskRunLogWithBLOBs;
import com.byit.model.RunRecording;
......@@ -13,10 +12,9 @@ import com.byit.service.mapservice.RunRecordingAndEmailService;
import com.byit.util.TimeFormatUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.List;
/**
......@@ -35,19 +33,19 @@ public class RunRecordingAndEmailServiceImpl implements RunRecordingAndEmailServ
*/
private final JobTaskRunLogService jobTaskRunLogService;
/**
* 文件系统
*/
private final FileSystem fileSystem;
/**
* 运行实例操作
*/
private final RunRecordingService runRecordingService;
@Value("${fdfs.tracker-list}")
private List<String> trackerIps;
@Value("${fdfs.http-port}")
private String trackerIpsPort;
public RunRecordingAndEmailServiceImpl(EmailAlarmService emailAlarmService, JobTaskRunLogService jobTaskRunLogService,
FileSystem fileSystem, RunRecordingService runRecordingService) {
RunRecordingService runRecordingService) {
this.emailAlarmService = emailAlarmService;
this.jobTaskRunLogService = jobTaskRunLogService;
this.fileSystem = fileSystem;
this.runRecordingService = runRecordingService;
}
......@@ -91,7 +89,7 @@ public class RunRecordingAndEmailServiceImpl implements RunRecordingAndEmailServ
.append("<th width = '10%'>结束时间</th>")
.append("<th width = '10%'>耗费时间</th>")
.append("<th width = '10%'>运行结果</th>")
.append("<th width = '50%'>运行日志</th>")
.append("<th width = '50%'>日志远程路径</th>")
.append("</thead>")
.append("<tbody>");
......@@ -103,19 +101,18 @@ public class RunRecordingAndEmailServiceImpl implements RunRecordingAndEmailServ
* String logFilePath = FILE_SYSTEM_PRE+fileSystemIp+":"+fileSystemPort+"/"+jobTaskRunLog.getLogRemotelyPath();
* String logFileUrl = String.format(iframeHtml,logFilePath);
*/
String logStr = null;
try {
String logStr = "无远程路径";
if(StringUtils.isNotBlank(jobTaskRunLog.getLogRemotelyPath())){
logStr = new String(fileSystem.downloaderFile(jobTaskRunLog.getLogRemotelyPath()), StandardCharsets.UTF_8);
}else if(StringUtils.isNotBlank(jobTaskRunLog.getRunMsg())) {
logStr = jobTaskRunLog.getRunMsg();
} else if (StringUtils.isNotBlank(jobTaskRunLog.getTriggerMsg())){
logStr = jobTaskRunLog.getTriggerMsg();
} else {
logStr = "未知异常,出现此错误属于系统错误,请联系myth-job-admin开发团队!";
logStr = jobTaskRunLog.getLogRemotelyPath();
if (CollectionUtil.isNotEmpty(trackerIps)) {
for (String ipPort : trackerIps) {
String ip = ipPort.split(":")[0];
String baseUrl = "http://"+ip+":"+trackerIpsPort+"/";
logStr = baseUrl + logStr+"\n";
log.debug("--------log远程路径为:{}------",logStr);
}
} catch (IOException e) {
e.printStackTrace();
}
}
stringBuilder.append("<tr align='center'>")
.append(String.format("<td>%s</td>", jobTaskRunLog.getNodeName()))
......@@ -127,7 +124,7 @@ public class RunRecordingAndEmailServiceImpl implements RunRecordingAndEmailServ
: "4".equals(jobTaskRunLog.getRunCode()) ? "补批失败" : "失败"))
.append("<td>")
.append("<div style='display:inline-block;width:100%;word-break:break-all;height: auto;overflow: auto;text-align: left;'>")
.append(String.format("%s", logStr==null?jobTaskRunLog.getRunMsg():logStr))
.append(String.format("%s", logStr))
.append("</div>")
.append("</td></tr>");
......
......@@ -7,6 +7,7 @@ import com.byit.service.RunRecordingService;
import com.byit.service.mapservice.RunRecordingAndEmailService;
import com.byit.thread.BaseThreadRunHelper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import javax.sql.DataSource;
......
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