我使用Quartz.Net作为调度系统的Windows服务。内置日志记录系统使用 Common.Logging框架但仅在初始化期间记录" 某些信息,然后仅在作业执行时发出有关严重问题的消息& #34; (见this link - 底部)。
为了记录我的作业的实际历史记录执行情况,我通过在服务的LoggingJobHistoryPlugin
文件中添加此行来成功配置quartz.config
:
quartz.plugin.triggHistory.type = Quartz.Plugin.History.LoggingJobHistoryPlugin
此时,执行日志记录工作正常(在所有appender中 - SQL数据库,文件等...)。你可以在这里看到摘录:
426 2014-11-07 10:30:05.997 ServerScheduler_Worker-7 INFO Quartz.Plugin.History.LoggingJobHistoryPlugin.JobWasExecuted(c:\Work\OpenSource\quartznet\src\Quartz\Plugin\History\LoggingJobHistoryPlugin.cs:432) Job Admin.Auto Sync execution complete at 08:30:05 11/07/2014 and reports:
425 2014-11-07 10:30:00.070 ServerScheduler_Worker-7 INFO Quartz.Plugin.History.LoggingJobHistoryPlugin.JobToBeExecuted(c:\Work\OpenSource\quartznet\src\Quartz\Plugin\History\LoggingJobHistoryPlugin.cs:383) Job Admin.Auto Sync fired (by trigger admin.Admin) at: 08:30:00 11/07/2014
我想要实现的是按照here所述更改默认日志记录格式。我尝试的是在quartz.config
文件中设置这些行:
quartz.plugin.triggHistory.jobToBeFiredMessage = *** Job {1}.{0} fired (by trigger {4}.{3}) at: {2, date, HH:mm:ss MM/dd/yyyy}
quartz.plugin.triggHistory.jobSuccessMessage = *** Job {1}.{0} execution complete at {2, date, HH:mm:ss MM/dd/yyyy} and reports: {8}
quartz.plugin.triggHistory.jobFailedMessage = *** Job {1}.{0} execution failed at {2, date, HH:mm:ss MM/dd/yyyy} and reports: {8}
但是在添加这些行之后,我在日志中遇到以下错误:
384 2014-11-07 10:24:00.037 ServerScheduler_Worker-3 ERROR Quartz.Core.QuartzScheduler.NotifySchedulerListenersError(c:\Work\OpenSource\quartznet\src\Quartz\Core\QuartzScheduler.cs:1877) Unable to notify JobListener(s) of Job to be executed: (Job will NOT be executed!). trigger= Test.Tr5 job= Test.1 minute
383 2014-11-07 10:23:00.027 ServerScheduler_Worker-2 ERROR Quartz.Core.QuartzScheduler.NotifySchedulerListenersError(c:\Work\OpenSource\quartznet\src\Quartz\Core\QuartzScheduler.cs:1877) Unable to notify JobListener(s) of Job to be executed: (Job will NOT be executed!). trigger= Test.Tr5 job= Test.1 minute
382 2014-11-07 10:22:00.143 ServerScheduler_Worker-1 ERROR Quartz.Core.QuartzScheduler.NotifySchedulerListenersError(c:\Work\OpenSource\quartznet\src\Quartz\Core\QuartzScheduler.cs:1877) Unable to notify JobListener(s) of Job to be executed: (Job will NOT be executed!). trigger= Test.Tr5 job= Test.1 minute
任何iddea如何才能使这项工作?
答案 0 :(得分:2)
遗憾的是,API文档存在错误,我现在已经在more up-to-date 2.0 documentation中对其进行了更正。日期的正确格式是标准的.NET字符串格式:
quartz.plugin.triggHistory.jobToBeFiredMessage = *** Job {1}.{0} fired (by trigger {4}.{3}) at: {2:HH:mm:ss MM/dd/yyyy}
quartz.plugin.triggHistory.jobSuccessMessage = *** Job {1}.{0} execution complete at {2:HH:mm:ss MM/dd/yyyy} and reports: {8}
quartz.plugin.triggHistory.jobFailedMessage = *** Job {1}.{0} execution failed at {2:HH:mm:ss MM/dd/yyyy} and reports: {8}