[C#][Quartz]添加监听器

2021-04-08 09:26

阅读:465

标签:mat   standby   red   nali   bug   delete   bre   shu   stat   

namespace Quartz.Listener
{
    public class SchedulerListener : SchedulerListenerSupport
    {
        private static log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name);
        public override void JobAdded(IJobDetail jobDetail)
        {
            log.DebugFormat("JobAdded.Group.{0}.Name.{1}.Description.{2}", jobDetail.Key.Group, jobDetail.Key.Name, jobDetail.Description);
            base.JobAdded(jobDetail);
        }

        public override void JobDeleted(JobKey jobKey)
        {
            log.DebugFormat("JobDeleted.Group.{0}.Name.{1}", jobKey.Group, jobKey.Name);
            base.JobDeleted(jobKey);
        }

        public override void JobPaused(JobKey jobKey)
        {
            log.DebugFormat("JobPaused.Group.{0}.Name.{1}", jobKey.Group, jobKey.Name);
            base.JobPaused(jobKey);
        }

        public override void JobResumed(JobKey jobKey)
        {
            log.DebugFormat("JobResumed.Group.{0}.Name.{1}", jobKey.Group, jobKey.Name);
            base.JobResumed(jobKey);
        }

        public override void JobScheduled(ITrigger trigger)
        {
            log.DebugFormat("JobScheduled.TriggerGroup.{0}.TriggerName.{1}.JobGroup.{2}.JobName.{3}", trigger.Key.Group, trigger.Key.Name, trigger.JobKey.Group, trigger.JobKey.Name);
            base.JobScheduled(trigger);
        }

        public override void JobsPaused(string jobGroup)
        {
            log.DebugFormat("JobsPaused.Group.{0}", jobGroup);
            base.JobsPaused(jobGroup);
        }

        public override void JobsResumed(string jobGroup)
        {
            log.DebugFormat("JobsResumed.Group.{0}", jobGroup);
            base.JobsResumed(jobGroup);
        }

        public override void JobUnscheduled(TriggerKey triggerKey)
        {
            log.DebugFormat("JobUnscheduled.TriggerGroup.{0}.TriggerName.{1}", triggerKey.Group, triggerKey.Name);
            base.JobUnscheduled(triggerKey);
        }

        public override void SchedulerError(string msg, SchedulerException cause)
        {
            log.ErrorFormat("SchedulerError.msg.{0}.cause.Message.{1}.cause.Source.{2}.cause.StackTrace.{3}.InnerException.Message.{4}",
                msg, cause.Message, cause.Source, cause.StackTrace, cause.InnerException.Message);
            base.SchedulerError(msg, cause);
        }

        public override void SchedulerInStandbyMode()
        {
            log.Warn("SchedulerInStandbyMode");
            base.SchedulerInStandbyMode();
        }

        public override void SchedulerShutdown()
        {
            log.Warn("SchedulerShutdown");
            base.SchedulerShutdown();
        }

        public override void SchedulerShuttingdown()
        {
            log.Warn("SchedulerShuttingdown");
            base.SchedulerShuttingdown();
        }

        public override void SchedulerStarted()
        {
            log.Warn("SchedulerStarted");
            base.SchedulerStarted();
        }

        public override void SchedulingDataCleared()
        {
            log.Warn("SchedulingDataCleared");
            base.SchedulingDataCleared();
        }

        public override void TriggerFinalized(ITrigger trigger)
        {
            log.DebugFormat("TriggerFinalized.TriggerGroup.{0}.TriggerName.{1}.JobGroup.{2}.JobName.{3}", trigger.Key.Group, trigger.Key.Name, trigger.JobKey.Group, trigger.JobKey.Name);
            base.TriggerFinalized(trigger);
        }

        public override void TriggerPaused(TriggerKey triggerKey)
        {
            log.DebugFormat("TriggerPaused.TriggerGroup.{0}.TriggerName.{1}", triggerKey.Group, triggerKey.Name);
            base.TriggerPaused(triggerKey);
        }

        public override void TriggerResumed(TriggerKey triggerKey)
        {
            log.DebugFormat("TriggerResumed.TriggerGroup.{0}.TriggerName.{1}", triggerKey.Group, triggerKey.Name);
            base.TriggerResumed(triggerKey);
        }

        public override void TriggersPaused(string triggerGroup)
        {
            log.DebugFormat("TriggersPaused.Group.{0}", triggerGroup);
            base.TriggersPaused(triggerGroup);
        }

        public override void TriggersResumed(string triggerGroup)
        {
            log.DebugFormat("TriggersResumed.Group.{0}", triggerGroup);
            base.TriggersResumed(triggerGroup);
        }
    }
}

 

[C#][Quartz]添加监听器

标签:mat   standby   red   nali   bug   delete   bre   shu   stat   

原文地址:https://www.cnblogs.com/z5337/p/9087552.html


评论


亲,登录后才可以留言!