• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

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

原作者: [db:作者] 来自: [db:来源] 收藏 邀请
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);
        }
    }
}

 


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C#计算方差样本差发布时间:2022-07-13
下一篇:
C#反射之创建对象实例发布时间:2022-07-13
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap