diff --git a/xxl-job-admin/Dockerfile b/xxl-job-admin/Dockerfile index fb6d81ba..8596a1f3 100644 --- a/xxl-job-admin/Dockerfile +++ b/xxl-job-admin/Dockerfile @@ -3,6 +3,7 @@ FROM openjdk:21-jdk-slim MAINTAINER xuxueli +ENV LOG_HOME=/data/applogs ENV PARAMS="" ENV TZ=PRC @@ -10,4 +11,4 @@ RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone ADD target/xxl-job-admin-*.jar /app.jar -ENTRYPOINT ["sh","-c","java -jar $JAVA_OPTS /app.jar $PARAMS"] \ No newline at end of file +ENTRYPOINT ["sh","-c","java -DLOG_HOME=$LOG_HOME -jar $JAVA_OPTS /app.jar $PARAMS"] \ No newline at end of file diff --git a/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/biz/JobLogController.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/biz/JobLogController.java index 50ab7e10..df22f8d1 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/biz/JobLogController.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/biz/JobLogController.java @@ -160,6 +160,59 @@ public class JobLogController { return Response.ofSuccess(pageModel); } + @RequestMapping("/logDetailPage") + public String logDetailPage(HttpServletRequest request, @RequestParam("id") long id, Model model){ + + // base check + XxlJobLog jobLog = xxlJobLogMapper.load(id); + if (jobLog == null) { + throw new RuntimeException(I18nUtil.getString("joblog_logid_unvalid")); + } + + // valid permission + JobGroupPermissionUtil.validJobGroupPermission(request, jobLog.getJobGroup()); + + // data + model.addAttribute("triggerCode", jobLog.getTriggerCode()); + model.addAttribute("handleCode", jobLog.getHandleCode()); + model.addAttribute("logId", jobLog.getId()); + return "joblog/joblog.detail"; + } + + @RequestMapping("/logDetailCat") + @ResponseBody + public Response logDetailCat(@RequestParam("logId") long logId, @RequestParam("fromLineNum") int fromLineNum){ + try { + // valid + XxlJobLog jobLog = xxlJobLogMapper.load(logId); // todo, need to improve performance + if (jobLog == null) { + return Response.ofFail(I18nUtil.getString("joblog_logid_unvalid")); + } + + // log cat + ExecutorBiz executorBiz = XxlJobAdminBootstrap.getExecutorBiz(jobLog.getExecutorAddress()); + Response logResult = executorBiz.log(new LogRequest(jobLog.getTriggerTime().getTime(), logId, fromLineNum)); + + // is end + if (logResult.getData()!=null && logResult.getData().getFromLineNum() > logResult.getData().getToLineNum()) { + if (jobLog.getHandleCode() > 0) { + logResult.getData().setEnd(true); + } + } + + // fix xss + if (logResult.getData()!=null && StringTool.isNotBlank(logResult.getData().getLogContent())) { + String newLogContent = filter(logResult.getData().getLogContent()); + logResult.getData().setLogContent(newLogContent); + } + + return logResult; + } catch (Exception e) { + logger.error(e.getMessage(), e); + return Response.ofFail(e.getMessage()); + } + } + /** * filter xss tag */ @@ -191,7 +244,7 @@ public class JobLogController { @RequestMapping("/logKill") @ResponseBody - public Response logKill(HttpServletRequest request, @RequestParam("id") int id){ + public Response logKill(HttpServletRequest request, @RequestParam("id") long id){ // base check XxlJobLog log = xxlJobLogMapper.load(id); XxlJobInfo jobInfo = xxlJobInfoMapper.loadById(log.getJobId()); diff --git a/xxl-job-executor-samples/xxl-job-executor-sample-springboot-ai/Dockerfile b/xxl-job-executor-samples/xxl-job-executor-sample-springboot-ai/Dockerfile new file mode 100644 index 00000000..d67f9f3a --- /dev/null +++ b/xxl-job-executor-samples/xxl-job-executor-sample-springboot-ai/Dockerfile @@ -0,0 +1,12 @@ +FROM openjdk:21-jdk-slim +MAINTAINER xuxueli + +ENV LOG_HOME=/data/applogs +ENV PARAMS="" + +ENV TZ=PRC +RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone + +ADD target/xxl-job-executor-sample-springboot-ai*.jar /app.jar + +ENTRYPOINT ["sh","-c","java -DLOG_HOME=$LOG_HOME -jar $JAVA_OPTS /app.jar $PARAMS"] \ No newline at end of file diff --git a/xxl-job-executor-samples/xxl-job-executor-sample-springboot/Dockerfile b/xxl-job-executor-samples/xxl-job-executor-sample-springboot/Dockerfile index 8648d945..175a8cc7 100644 --- a/xxl-job-executor-samples/xxl-job-executor-sample-springboot/Dockerfile +++ b/xxl-job-executor-samples/xxl-job-executor-sample-springboot/Dockerfile @@ -1,6 +1,7 @@ -FROM openjdk:8-jre-slim +FROM openjdk:21-jdk-slim MAINTAINER xuxueli +ENV LOG_HOME=/data/applogs ENV PARAMS="" ENV TZ=PRC @@ -8,4 +9,4 @@ RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone ADD target/xxl-job-executor-sample-springboot-*.jar /app.jar -ENTRYPOINT ["sh","-c","java -jar $JAVA_OPTS /app.jar $PARAMS"] \ No newline at end of file +ENTRYPOINT ["sh","-c","java -DLOG_HOME=$LOG_HOME -jar $JAVA_OPTS /app.jar $PARAMS"] \ No newline at end of file