public static LogRunModel GetLogRunModelByRow(string line) { if (String.IsNullOrEmpty(line)) { return(null); } var arr = line.Split(new[] { LogConfig.LogSplit }, StringSplitOptions.RemoveEmptyEntries); if (arr.Length != 7) { return(null); } LogRunModel model = new LogRunModel(); model.JobName = arr[0]; model.JobGroupName = arr[1]; model.JobType = arr[2]; model.JobData = arr[3]; model.CronExpression = arr[4]; model.ExecuteTime = arr[5]; model.ExecuteResult = arr[6]; return(model); }
public void LogRun(IJobExecutionContext context, string result) { LogRunModel model = new LogRunModel(); if (context.Trigger is ICronTrigger) { var cTrigger = (ICronTrigger)context.Trigger; model.CronExpression = cTrigger.CronExpressionString ?? "-"; } else { model.CronExpression = "-"; } model.ExecuteTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); model.JobName = context.JobDetail.Key.Name; model.JobGroupName = context.JobDetail.Key.Group; model.JobType = context.JobDetail.JobType.FullName; model.JobData = JobUtils.GetJobDataString(context.JobDetail.JobDataMap); model.ExecuteResult = result; lock (LockHelper) { _queueRunInfo.Enqueue(model); } }
private static string GetStringLineRun(LogRunModel model) { StringBuilder sb = new StringBuilder(); sb.Append(model.JobName).Append(LogConfig.LogSplit); sb.Append(model.JobGroupName).Append(LogConfig.LogSplit); sb.Append(model.JobType).Append(LogConfig.LogSplit); sb.Append(model.JobData).Append(LogConfig.LogSplit); sb.Append(model.CronExpression).Append(LogConfig.LogSplit); sb.Append(model.ExecuteTime).Append(LogConfig.LogSplit); sb.Append(model.ExecuteResult); return(sb.ToString()); }