日志Log重构

v1.3
xueli.xue 9 years ago
commit 743fef2034

@ -8,6 +8,7 @@ import java.util.Map.Entry;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.quartz.JobExecutionContext; import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException; import org.quartz.JobExecutionException;
import org.quartz.impl.triggers.CronTriggerImpl;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.scheduling.quartz.QuartzJobBean; import org.springframework.scheduling.quartz.QuartzJobBean;
@ -40,10 +41,17 @@ public class HttpJobBean extends QuartzJobBean {
} }
} }
// corn
String cornExp = null;
if (context.getTrigger() instanceof CronTriggerImpl) {
CronTriggerImpl trigger = (CronTriggerImpl) context.getTrigger();
cornExp = trigger.getCronExpression();
}
// save log // save log
XxlJobLog jobLog = new XxlJobLog(); XxlJobLog jobLog = new XxlJobLog();
jobLog.setJobName(triggerKey); jobLog.setJobName(triggerKey);
jobLog.setJobCron(null); jobLog.setJobCron(cornExp);
jobLog.setJobClass(HttpJobBean.class.getName()); jobLog.setJobClass(HttpJobBean.class.getName());
jobLog.setJobData(JacksonUtil.writeValueAsString(params)); jobLog.setJobData(JacksonUtil.writeValueAsString(params));
DynamicSchedulerUtil.xxlJobLogDao.save(jobLog); DynamicSchedulerUtil.xxlJobLogDao.save(jobLog);

@ -16,19 +16,25 @@ $(function() {
"columns": [ "columns": [
{ "data": 'id', "bSortable": false, "visible" : false}, { "data": 'id', "bSortable": false, "visible" : false},
{ "data": 'jobName', "bSortable": false}, { "data": 'jobName', "bSortable": false},
{ "data": 'jobCron', "bSortable": false}, { "data": 'jobCron', "bSortable": false, "visible" : false},
{ "data": 'jobClass', "bSortable": false}, { "data": 'jobClass', "bSortable": false, "visible" : false},
{ "data": 'jobData', "bSortable": false}, { "data": 'jobData', "bSortable": false, "visible" : false},
{ {
"data": 'triggerTime', "data": 'triggerTime',
"bSortable": false, "bSortable": false,
"render": function ( data, type, row ) { "render": function ( data, type, row ) {
return moment(new Date(data)).format("YYYY-MM-DD HH:mm:ss"); return data?moment(new Date(data)).format("YYYY-MM-DD HH:mm:ss"):"";
} }
}, },
{ "data": 'triggerStatus', "bSortable": false}, { "data": 'triggerStatus', "bSortable": false},
{ "data": 'triggerMsg',"bSortable": false}, { "data": 'triggerMsg',"bSortable": false},
{ "data": 'handleTime',"bSortable": false}, {
"data": 'handleTime',
"bSortable": false,
"render": function ( data, type, row ) {
return data?moment(new Date(data)).format("YYYY-MM-DD HH:mm:ss"):"";
}
},
{ "data": 'handleStatus',"bSortable": false}, { "data": 'handleStatus',"bSortable": false},
{ "data": 'handleMsg' , "bSortable": false} { "data": 'handleMsg' , "bSortable": false}
], ],

@ -94,7 +94,7 @@ public class HandlerRepository {
new Object[]{handlerData, _status, _msg, callback_response, this}); new Object[]{handlerData, _status, _msg, callback_response, this});
} else { } else {
try { try {
TimeUnit.SECONDS.sleep(1); TimeUnit.MILLISECONDS.sleep(200);
} catch (InterruptedException e) { } catch (InterruptedException e) {
e.printStackTrace(); e.printStackTrace();
} }

Loading…
Cancel
Save