From 45bac140b78e44cc4f81d990a3126219632db874 Mon Sep 17 00:00:00 2001 From: xuxueli <931591021@qq.com> Date: Mon, 30 Oct 2017 10:58:20 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BA=95=E5=B1=82=E7=B3=BB=E7=BB=9F=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E7=BA=A7=E5=88=AB=E8=B0=83=E6=95=B4=EF=BC=8C=E9=AB=98?= =?UTF-8?q?=E9=A2=91=E9=9D=9E=E6=A0=B8=E5=BF=83=E6=97=A5=E5=BF=97=E8=B0=83?= =?UTF-8?q?=E6=95=B4=E4=B8=BAdebug=E7=BA=A7=E5=88=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- doc/XXL-JOB官方文档.md | 1 + .../admin/core/jobbean/LocalNomalJobBean.java | 94 ------------------- .../jobbean/impl/DemoConcurrentJobBean.java | 30 ------ .../core/jobbean/impl/DemoNomalJobBean.java | 32 ------- .../core/thread/JobFailMonitorHelper.java | 2 +- .../job/admin/core/trigger/XxlJobTrigger.java | 2 +- .../com/xxl/job/admin/core/util/MailUtil.java | 2 +- .../job/admin/service/impl/AdminBizImpl.java | 2 +- .../com/xxl/job/core/log/XxlJobLogger.java | 2 +- .../rpc/netcom/jetty/server/JettyServer.java | 2 +- .../core/thread/ExecutorRegistryThread.java | 6 +- .../com/xxl/job/core/thread/JobThread.java | 4 +- .../core/thread/TriggerCallbackThread.java | 4 +- .../com/xxl/job/core/util/HttpClientUtil.java | 2 +- 14 files changed, 15 insertions(+), 170 deletions(-) delete mode 100644 xxl-job-admin/src/main/java/com/xxl/job/admin/core/jobbean/LocalNomalJobBean.java delete mode 100644 xxl-job-admin/src/main/java/com/xxl/job/admin/core/jobbean/impl/DemoConcurrentJobBean.java delete mode 100644 xxl-job-admin/src/main/java/com/xxl/job/admin/core/jobbean/impl/DemoNomalJobBean.java diff --git a/doc/XXL-JOB官方文档.md b/doc/XXL-JOB官方文档.md index 28398ced..bc4e06d1 100644 --- a/doc/XXL-JOB官方文档.md +++ b/doc/XXL-JOB官方文档.md @@ -1025,6 +1025,7 @@ Tips: 历史版本(V1.3.x)目前已经Release至稳定版本, 进入维护阶段 - 4、修复任务监控线程无法监控任务触发和执行状态均未0的问题; - 5、调度中心项目日志配置改为xml文件格式; - 6、执行器动态代理对象,拦截非业务方法的执行; +- 7、底层系统日志级别规范调整,清理遗留代码; ### TODO LIST - 1、任务权限管理:执行器为粒度分配权限,核心操作校验权限; diff --git a/xxl-job-admin/src/main/java/com/xxl/job/admin/core/jobbean/LocalNomalJobBean.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/core/jobbean/LocalNomalJobBean.java deleted file mode 100644 index 067e10f4..00000000 --- a/xxl-job-admin/src/main/java/com/xxl/job/admin/core/jobbean/LocalNomalJobBean.java +++ /dev/null @@ -1,94 +0,0 @@ -package com.xxl.job.admin.core.jobbean; -//package com.xxl.job.action.job; -// -//import java.io.PrintWriter; -//import java.io.StringWriter; -//import java.util.Date; -//import java.util.HashMap; -//import java.util.Map; -// -//import org.apache.commons.lang.StringUtils; -//import org.quartz.JobExecutionContext; -//import org.quartz.JobExecutionException; -//import org.quartz.JobKey; -//import org.slf4j.Logger; -//import org.slf4j.LoggerFactory; -//import org.springframework.scheduling.quartz.QuartzJobBean; -// -//import com.xxl.job.client.handler.HandlerRouter; -//import com.xxl.job.client.util.XxlJobNetCommUtil.RemoteCallBack; -//import com.xxl.job.client.util.JacksonUtil; -//import com.xxl.job.core.model.XxlJobInfo; -//import com.xxl.job.core.model.XxlJobLog; -//import com.xxl.job.core.thread.JobFailMonitorHelper; -//import com.xxl.job.core.util.DynamicSchedulerUtil; -// -///** -// * http job bean -// * @author xuxueli 2015-12-17 18:20:34 -// */ -//@Deprecated -//public abstract class LocalNomalJobBean extends QuartzJobBean { -// private static Logger logger = LoggerFactory.getLogger(LocalNomalJobBean.class); -// -// @Override -// protected void executeInternal(JobExecutionContext context) -// throws JobExecutionException { -// JobKey jobKey = context.getTrigger().getJobKey(); -// -// XxlJobInfo jobInfo = DynamicSchedulerUtil.xxlJobInfoDao.load(jobKey.getGroup(), jobKey.getName()); -// @SuppressWarnings("unchecked") -// HashMap jobDataMap = (HashMap) JacksonUtil.readValueRefer(jobInfo.getJobData(), Map.class); -// -// // save log -// XxlJobLog jobLog = new XxlJobLog(); -// jobLog.setJobGroup(jobInfo.getJobGroup()); -// jobLog.setJobName(jobInfo.getJobName()); -// jobLog.setJobCron(jobInfo.getJobCron()); -// jobLog.setJobDesc(jobInfo.getJobDesc()); -// jobLog.setJobClass(jobInfo.getJobClass()); -// jobLog.setJobData(jobInfo.getJobData()); -// -// jobLog.setJobClass(RemoteHttpJobBean.class.getName()); -// jobLog.setJobData(jobInfo.getJobData()); -// DynamicSchedulerUtil.xxlJobLogDao.save(jobLog); -// logger.info(">>>>>>>>>>> xxl-job trigger start, jobLog:{}", jobLog); -// -// // trigger request -// String handler_params = jobDataMap.get(HandlerRouter.HANDLER_PARAMS); -// String[] handlerParams = null; -// if (StringUtils.isNotBlank(handler_params)) { -// handlerParams = handler_params.split(","); -// } -// -// jobLog.setTriggerTime(new Date()); -// jobLog.setTriggerStatus(RemoteCallBack.SUCCESS); -// jobLog.setTriggerMsg(null); -// -// try { -// Object responseMsg = this.handle(handlerParams); -// -// jobLog.setHandleTime(new Date()); -// jobLog.setHandleStatus(RemoteCallBack.SUCCESS); -// jobLog.setHandleMsg(JacksonUtil.writeValueAsString(responseMsg)); -// } catch (Exception e) { -// logger.info("JobThread Exception:", e); -// StringWriter out = new StringWriter(); -// e.printStackTrace(new PrintWriter(out)); -// -// jobLog.setHandleTime(new Date()); -// jobLog.setHandleStatus(RemoteCallBack.FAIL); -// jobLog.setHandleMsg(out.toString()); -// } -// -// // update trigger info -// DynamicSchedulerUtil.xxlJobLogDao.updateTriggerInfo(jobLog); -// DynamicSchedulerUtil.xxlJobLogDao.updateHandleInfo(jobLog); -// JobFailMonitorHelper.monitor(jobLog.getId()); -// logger.info(">>>>>>>>>>> xxl-job trigger end, jobLog.id:{}, jobLog:{}", jobLog.getId(), jobLog); -// -// } -// -// public abstract Object handle(String... param); -// -//} \ No newline at end of file diff --git a/xxl-job-admin/src/main/java/com/xxl/job/admin/core/jobbean/impl/DemoConcurrentJobBean.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/core/jobbean/impl/DemoConcurrentJobBean.java deleted file mode 100644 index a64ef5b7..00000000 --- a/xxl-job-admin/src/main/java/com/xxl/job/admin/core/jobbean/impl/DemoConcurrentJobBean.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.xxl.job.admin.core.jobbean.impl; -//package com.xxl.job.action.job.impl; -// -//import java.util.concurrent.TimeUnit; -// -//import org.quartz.DisallowConcurrentExecution; -// -//import com.xxl.job.action.job.LocalNomalJobBean; -// -///** -// * demo job bean for no-concurrent -// * @author xuxueli 2016-3-12 14:25:14 -// */ -//@Deprecated -//@DisallowConcurrentExecution // 串行;线程数要多配置几个,否则不生效; -//public class DemoConcurrentJobBean extends LocalNomalJobBean { -// -// @Override -// public Object handle(String... param) { -// -// try { -// TimeUnit.SECONDS.sleep(10); -// } catch (InterruptedException e) { -// logger.error(e.getMessage(), e); -// } -// -// return false; -// } -// -//} diff --git a/xxl-job-admin/src/main/java/com/xxl/job/admin/core/jobbean/impl/DemoNomalJobBean.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/core/jobbean/impl/DemoNomalJobBean.java deleted file mode 100644 index ccb7c41d..00000000 --- a/xxl-job-admin/src/main/java/com/xxl/job/admin/core/jobbean/impl/DemoNomalJobBean.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.xxl.job.admin.core.jobbean.impl; -//package com.xxl.job.action.job.impl; -// -//import java.util.concurrent.TimeUnit; -// -//import org.slf4j.Logger; -//import org.slf4j.LoggerFactory; -// -//import com.xxl.job.action.job.LocalNomalJobBean; -// -///** -// * demo job bean for concurrent -// * @author xuxueli 2016-3-12 14:25:57 -// */ -//@Deprecated -//public class DemoNomalJobBean extends LocalNomalJobBean { -// private static Logger Logger = LoggerFactory.getLogger(DemoNomalJobBean.class); -// -// @Override -// public Object handle(String... param) { -// Logger.info("DemoNomalJobBean run :" + param); -// -// try { -// TimeUnit.SECONDS.sleep(10); -// } catch (InterruptedException e) { -// logger.error(e.getMessage(), e); -// } -// -// return false; -// } -// -//} diff --git a/xxl-job-admin/src/main/java/com/xxl/job/admin/core/thread/JobFailMonitorHelper.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/core/thread/JobFailMonitorHelper.java index 991d5106..a19c1781 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/admin/core/thread/JobFailMonitorHelper.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/core/thread/JobFailMonitorHelper.java @@ -63,7 +63,7 @@ public class JobFailMonitorHelper { logger.info(">>>>>>>>>>> job monitor, job fail, JobLogId:{}", jobLogId); } else { JobFailMonitorHelper.monitor(jobLogId); - logger.info(">>>>>>>>>>> job monitor, job unknown, JobLogId:{}", jobLogId); + logger.info(">>>>>>>>>>> job monitor, job status unknown, JobLogId:{}", jobLogId); } } } diff --git a/xxl-job-admin/src/main/java/com/xxl/job/admin/core/trigger/XxlJobTrigger.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/core/trigger/XxlJobTrigger.java index 48fc850a..6482922f 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/admin/core/trigger/XxlJobTrigger.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/core/trigger/XxlJobTrigger.java @@ -35,7 +35,7 @@ public class XxlJobTrigger { // load data XxlJobInfo jobInfo = XxlJobDynamicScheduler.xxlJobInfoDao.loadById(jobId); // job info if (jobInfo == null) { - logger.warn(">>>>>>>>>>>> xxl-job trigger fail, jobId invalid,jobId={}", jobId); + logger.warn(">>>>>>>>>>>> trigger fail, jobId invalid,jobId={}", jobId); return; } XxlJobGroup group = XxlJobDynamicScheduler.xxlJobGroupDao.load(jobInfo.getJobGroup()); // group info diff --git a/xxl-job-admin/src/main/java/com/xxl/job/admin/core/util/MailUtil.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/core/util/MailUtil.java index 07e5cc21..1bba0ecb 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/admin/core/util/MailUtil.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/core/util/MailUtil.java @@ -93,7 +93,7 @@ public class MailUtil { javaMailSender.send(mimeMessage); return true; } catch (Exception e) { - logger.info("{}", e); + logger.error(e.getMessage(), e); } return false; } diff --git a/xxl-job-admin/src/main/java/com/xxl/job/admin/service/impl/AdminBizImpl.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/service/impl/AdminBizImpl.java index a2f05cae..718b4554 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/admin/service/impl/AdminBizImpl.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/service/impl/AdminBizImpl.java @@ -45,7 +45,7 @@ public class AdminBizImpl implements AdminBiz { public ReturnT callback(List callbackParamList) { for (HandleCallbackParam handleCallbackParam: callbackParamList) { ReturnT callbackResult = callback(handleCallbackParam); - logger.info("JobApiController.callback {}, handleCallbackParam={}, callbackResult={}", + logger.info(">>>>>>>>> JobApiController.callback {}, handleCallbackParam={}, callbackResult={}", (callbackResult.getCode()==ReturnT.SUCCESS_CODE?"success":"fail"), handleCallbackParam, callbackResult); } diff --git a/xxl-job-core/src/main/java/com/xxl/job/core/log/XxlJobLogger.java b/xxl-job-core/src/main/java/com/xxl/job/core/log/XxlJobLogger.java index 6c82a3d7..f9b970ca 100644 --- a/xxl-job-core/src/main/java/com/xxl/job/core/log/XxlJobLogger.java +++ b/xxl-job-core/src/main/java/com/xxl/job/core/log/XxlJobLogger.java @@ -43,7 +43,7 @@ public class XxlJobLogger { // appendlog XxlJobFileAppender.appendLog(logFileName, formatAppendLog); - logger.warn("[{}]: {}", logFileName, formatAppendLog); + logger.debug(">>>>>>>>>>> [{}]: {}", logFileName, formatAppendLog); } /** diff --git a/xxl-job-core/src/main/java/com/xxl/job/core/rpc/netcom/jetty/server/JettyServer.java b/xxl-job-core/src/main/java/com/xxl/job/core/rpc/netcom/jetty/server/JettyServer.java index 76730ec0..ae9dfec9 100644 --- a/xxl-job-core/src/main/java/com/xxl/job/core/rpc/netcom/jetty/server/JettyServer.java +++ b/xxl-job-core/src/main/java/com/xxl/job/core/rpc/netcom/jetty/server/JettyServer.java @@ -44,7 +44,7 @@ public class JettyServer { try { // Start server server.start(); - logger.info(">>>>>>>>>>>> xxl-job jetty server start success at port:{}.", port); + logger.info(">>>>>>>>>>> xxl-job jetty server start success at port:{}.", port); // Start Registry-Server ExecutorRegistryThread.getInstance().start(port, ip, appName); diff --git a/xxl-job-core/src/main/java/com/xxl/job/core/thread/ExecutorRegistryThread.java b/xxl-job-core/src/main/java/com/xxl/job/core/thread/ExecutorRegistryThread.java index 02ccf23b..1e3b1377 100644 --- a/xxl-job-core/src/main/java/com/xxl/job/core/thread/ExecutorRegistryThread.java +++ b/xxl-job-core/src/main/java/com/xxl/job/core/thread/ExecutorRegistryThread.java @@ -28,11 +28,11 @@ public class ExecutorRegistryThread extends Thread { // valid if (appName==null || appName.trim().length()==0) { - logger.warn(">>>>>>>>>>>> xxl-job, executor registry config fail, appName is null."); + logger.warn(">>>>>>>>>>> xxl-job, executor registry config fail, appName is null."); return; } if (XxlJobExecutor.getAdminBizList() == null) { - logger.warn(">>>>>>>>>>>> xxl-job, executor registry config fail, adminAddresses is null."); + logger.warn(">>>>>>>>>>> xxl-job, executor registry config fail, adminAddresses is null."); return; } @@ -99,7 +99,7 @@ public class ExecutorRegistryThread extends Thread { } catch (Exception e) { logger.error(e.getMessage(), e); } - logger.warn(">>>>>>>>>>>> xxl-job, executor registry thread destory."); + logger.info(">>>>>>>>>>> xxl-job, executor registry thread destory."); } }); diff --git a/xxl-job-core/src/main/java/com/xxl/job/core/thread/JobThread.java b/xxl-job-core/src/main/java/com/xxl/job/core/thread/JobThread.java index 37c840b1..ae385f3f 100644 --- a/xxl-job-core/src/main/java/com/xxl/job/core/thread/JobThread.java +++ b/xxl-job-core/src/main/java/com/xxl/job/core/thread/JobThread.java @@ -57,7 +57,7 @@ public class JobThread extends Thread{ public ReturnT pushTriggerQueue(TriggerParam triggerParam) { // avoid repeat if (triggerLogIdSet.contains(triggerParam.getLogId())) { - logger.debug("repeate trigger job, logId:{}", triggerParam.getLogId()); + logger.info(">>>>>>>>>>> repeate trigger job, logId:{}", triggerParam.getLogId()); return new ReturnT(ReturnT.FAIL_CODE, "repeate trigger job, logId:" + triggerParam.getLogId()); } @@ -171,6 +171,6 @@ public class JobThread extends Thread{ } } - logger.info(">>>>>>>>>>>> xxl-job JobThread stoped, hashCode:{}", Thread.currentThread()); + logger.info(">>>>>>>>>>> xxl-job JobThread stoped, hashCode:{}", Thread.currentThread()); } } diff --git a/xxl-job-core/src/main/java/com/xxl/job/core/thread/TriggerCallbackThread.java b/xxl-job-core/src/main/java/com/xxl/job/core/thread/TriggerCallbackThread.java index 9126c4a3..23b56c93 100644 --- a/xxl-job-core/src/main/java/com/xxl/job/core/thread/TriggerCallbackThread.java +++ b/xxl-job-core/src/main/java/com/xxl/job/core/thread/TriggerCallbackThread.java @@ -40,7 +40,7 @@ public class TriggerCallbackThread { // valid if (XxlJobExecutor.getAdminBizList() == null) { - logger.warn(">>>>>>>>>>>> xxl-job, executor callback config fail, adminAddresses is null."); + logger.warn(">>>>>>>>>>> xxl-job, executor callback config fail, adminAddresses is null."); return; } @@ -80,7 +80,7 @@ public class TriggerCallbackThread { } catch (Exception e) { logger.error(e.getMessage(), e); } - logger.warn(">>>>>>>>>>>> xxl-job, executor callback thread destory."); + logger.info(">>>>>>>>>>> xxl-job, executor callback thread destory."); } }); diff --git a/xxl-job-core/src/main/java/com/xxl/job/core/util/HttpClientUtil.java b/xxl-job-core/src/main/java/com/xxl/job/core/util/HttpClientUtil.java index 417a80ff..cbb846a8 100644 --- a/xxl-job-core/src/main/java/com/xxl/job/core/util/HttpClientUtil.java +++ b/xxl-job-core/src/main/java/com/xxl/job/core/util/HttpClientUtil.java @@ -64,7 +64,7 @@ public class HttpClientUtil { EntityUtils.consume(entity); } } catch (Exception e) { - logger.error("", e); + logger.error(e.getMessage(), e); throw e; } finally { httpPost.releaseConnection();