views:

1106

answers:

1

I am using Quartz .Net for scheduling some custom tasks in our application. Everything works fine except that it logs about twenty debug entries in one second. I dont know how to turn off the debug logging. Any help would be really appreciated as I have been trying to lookup in the net with no luck.

The debug entries look like the below

DEBUG 2009-05-12 03:24:14,000 8612670ms StdRowLockSemaphore ObtainLock - Lock 'TRIGGER_ACCESS' is desired by: SchedulerFactory_QuartzSchedulerThread

DEBUG 2009-05-12 03:24:14,029 8612699ms StdRowLockSemaphore ExecuteSQL - Lock 'TRIGGER_ACCESS' is being obtained: SchedulerFactory_QuartzSchedulerThread

DEBUG 2009-05-12 03:24:14,029 8612699ms StdRowLockSemaphore ObtainLock - Lock 'TRIGGER_ACCESS' given to: SchedulerFactory_QuartzSchedulerThread

DEBUG 2009-05-12 03:24:14,034 8612704ms StdRowLockSemaphore ReleaseLock - Lock 'TRIGGER_ACCESS' returned by: SchedulerFactory_QuartzSchedulerThread

DEBUG 2009-05-12 03:24:14,035 8612705ms StdRowLockSemaphore ObtainLock - Lock 'TRIGGER_ACCESS' is desired by: SchedulerFactory_QuartzSchedulerThread

DEBUG 2009-05-12 03:24:14,035 8612705ms JobRunShell Run - Calling Execute on job DEFAULT.ProcessIncomingMTRJob

+3  A: 

Quartz.net uses Common.Logging, so something like this in your App.config/Web.config:

<configSections>
    <sectionGroup name="common">
        <section name="logging" type="Common.Logging.ConfigurationSectionHandler, Common.Logging" />
    </sectionGroup>
</configSections>

<common>
    <logging>
        <factoryAdapter type="Common.Logging.Simple.**youradapterhere**, Common.Logging">
            <arg key="level" value="ERROR" />
        </factoryAdapter>
    </logging>
</common>

Be sure to change the youradapterhere to the actual logging adapter you're using, or NoOpLoggerFactoryAdapter if you want to disable logging entirely.


** Edit: ** Based on Ganesh's comment:

<sectionGroup name="common"> 
    <section name="logging" type="Common.Logging.ConfigurationSectionHandler, Common.Logging"/> 
</sectionGroup> 
<common>  
    <logging>  
        <factoryAdapter type="Common.Logging.Log4Net.Log4NetLoggerFactoryAdapter, Common.Logging.Log4Net">  
            <arg key="configType" value="INLINE"/>  
            <arg key="configFile" value="filename"/>  
            <arg key="level" value="ERROR" /> <!-- add this line here -->
        </factoryAdapter>  
    </logging> 
</common>


** Edit 2: **

For the benefits of those who don't want to read the comments, the log level was actually set in the log4net root config:

<log4net>
    <root>
        <level value="DEBUG" /> <!-- This is the value that needed changing -->
        <appender-ref ref="Console" />
        <appender-ref ref="RollingFile" />
    </root>
</log4net>
Rytmis
We are already using the Common.Logging in our ASP .Net application. The entry in the web.config looks as below.Can you help me out as to where do i add the entry you suggested<sectionGroup name="common"><section name="logging" type="Common.Logging.ConfigurationSectionHandler, Common.Logging"/></sectionGroup><common> <logging> <factoryAdapter type="Common.Logging.Log4Net.Log4NetLoggerFactoryAdapter, Common.Logging.Log4Net"> <arg key="configType" value="INLINE"/> <arg key="configFile" value="filename"/> </factoryAdapter> </logging></common>
Ganesh
I edited my answer with your config and added the relevant line.
Rytmis
We are also logging info from the component which Quartz .net invokes as a scheduled job. Is it possible to specify multiple values in the key<arg key="level" value="ERROR" /> <!-- add this line here -->Will this be possible<arg key="level" value="ERROR, INFO, WARN" />Thanks for all your help
Ganesh
Log4Net docs say the following: "A log request of level L in a logger with (either assigned or inherited, whichever is appropriate) level K, is enabled if L >= K. This rule is at the heart of log4net. It assumes that levels are ordered. For the standard levels, we have DEBUG < INFO < WARN < ERROR < FATAL." The way I interpret that is, if you set loglevel to INFO, you will also get all messages from levels WARN, ERROR and FATAL. So you should replace ERROR with INFO in my example.
Rytmis
As per your advice i added the specified line to the web.config at the recommended position, but Quartz .Net is still printing the DEBUG log messages. The line I added is<arg key="level" value="INFO" />Any idea as to why it is not working?
Ganesh
Do you have any appender-specific configurations that would have a <level value="DEBUG" /> setting in the config file?
Rytmis
The root tag, configuration is <level value="All"/>and I changed it to <level value="INFO"/>Quartz.Net has stopped the Debug logging but it still logs, minimum of about 5 Info entries per second.Is there a way to control the logging from the jobs.xml file which configures the triggers and schedule for Quartz .Net?
Ganesh
Not that I know of. Taking a quick peek at some of the sources, it looks like the logging is configured by level, not by action, so I suspect your best bet is just specifying a different log level.
Rytmis