码迷,mamicode.com
首页 > Windows程序 > 详细

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

时间:2018-05-25 13:54:23      阅读:297      评论:0      收藏:0      [点我收藏+]

标签: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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!