Search code examples
c#quartz-schedulerquartz.net

Preventing Quartz.NET from logging JobExecutionException


I've implemented a Quartz.NET scheduler which is initialised from quartz.config using the standard method i.e.

    _schedulerFactory = new StdSchedulerFactory();
    _scheduler = _schedulerFactory.GetScheduler();

My understanding was out of the box Quartz doesn't log anything unless you explicitly wire up a Job or Trigger listener, however I'm getting a lot of logging, in particular when I throw a JobExecutionException I get the following INFO message which includes the full stack trace of the inner exception. I don't want this as I'm handling the exception myself in a JobListener and only want to log actual exceptions (I'm throwing FileNotFound exceptions and the JobListener will reschedule later so don't want to log this as an error)

How can I prevent JobRunShell from logging?

2016-03-17 12:31:33,677 JobSchedulerService_Worker-1 INFO  JobRunShell                    Run                    Job Jobs.TestJob threw a JobExecutionException: 

Solution

  • As Quartz.NET is using Common.Logging abstraction, which you have to configure to use logging framework of your choice, best way to disable logs from Quartz is in your's logging framework configuration.

    Example for Log4net (xml config):

    <logger name="Quartz">
       <level value="OFF" />
    </logger>