Quartz.Net - Common Logging with log4net
Asked Answered
A

3

7

I'm trying to implement Quartz.Net. As long as there is no logging configured everything works (the debug output shows "no configuration section found - suppressing logging output").

When logging is enabled I'll get the following error: Failed obtaining configuration for Common.Logging from configuration section 'common/logging'.

Inner exeption: An error occurred creating the configuration section handler for common/logging: Unable to create type 'Common.Logging.Log4Net.Log4NetLoggerFactoryAdapter, Common.Logging.Log4net'

I used several resources as this one to varify my configuration, but as far as I see it should be correct.

My app.config:

  <configSections>
    <section name="quartz" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.5000.0,Culture=neutral, PublicKeyToken=b77a5c561934e089" />
    <sectionGroup name="common">
      <section name="logging" type="Common.Logging.ConfigurationSectionHandler, Common.Logging" />
    </sectionGroup>
    <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
  </configSections>
  <common>
    <logging>
      <factoryAdapter type="Common.Logging.Log4Net.Log4NetLoggerFactoryAdapter, Common.Logging.Log4net">
        <arg key="configType" value="INLINE" />
      </factoryAdapter>
    </logging>
  </common>  
  <log4net>
    <appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender">
      <layout type="log4net.Layout.PatternLayout">
        <param name="ConversionPattern" value="%-6p%d{yyyy-MM-dd hh:mm:ss} – %m%n" />
      </layout>
    </appender>
    <root>
      <level value="DEBUG" />
      <appender-ref ref="ConsoleAppender" />
    </root>
  </log4net>
  <quartz>
    <add key="quartz.scheduler.instanceName" value="Driver.Service.Scheduler" />
    <add key="quartz.threadPool.type" value="Quartz.Simpl.SimpleThreadPool, Quartz" />
    <add key="quartz.threadPool.threadCount" value="10" />
    <add key="quartz.threadPool.threadPriority" value="2" />
    <add key="quartz.jobStore.misfireThreshold" value="60000" />
    <add key="quartz.jobStore.type" value="Quartz.Simpl.RAMJobStore, Quartz" />
  </quartz>

I referenced the following assemblies:
quartz.dll, version 2.01.100
common.logging.dll, version 2.0.0.0
common.logging.log4net.dll, version 2.0.0.0
log4net.dll, version 1.2.10.0

I cannot find a reason for the error given. All help is welcome, apparently I forget something...

Argal answered 7/11, 2012 at 20:5 Comment(0)
S
5

Can you check that Common.Logging.Log4net.dll is being copied to your bin output folder.

Also are you sure you don't have a inner exception on your inner exception (or maybe several levels of inner exceptions) ?

Shirberg answered 8/11, 2012 at 20:8 Comment(1)
I already checked if the required dll's were copied to the bin folder of the library I'm building. What I did not check was the bin folder of the test console app, and that's where they were missing. Thanks!Argal
L
12

We had similar situation when we upgraded to the new version of Common.Logging.Log4Net where the DLL name to changed to Common.Logging.Log4Net1211 from Common.Logging.Log4Net.

So, we modified the configuration file to change DLL name:

<factoryAdapter type="Common.Logging.Log4Net.Log4NetLoggerFactoryAdapter, Common.Logging.Log4Net1211">

Anyway, the error definitely indicates missing DLL.

Louralourdes answered 22/8, 2014 at 18:14 Comment(1)
More information about this can be found at: github.com/net-commons/common-logging/wiki/…Zarate
S
5

Can you check that Common.Logging.Log4net.dll is being copied to your bin output folder.

Also are you sure you don't have a inner exception on your inner exception (or maybe several levels of inner exceptions) ?

Shirberg answered 8/11, 2012 at 20:8 Comment(1)
I already checked if the required dll's were copied to the bin folder of the library I'm building. What I did not check was the bin folder of the test console app, and that's where they were missing. Thanks!Argal
A
0

Im not sure, but in your common/logging config section, one time its written log4net and one time its log4Net (capital letter):

  <factoryAdapter type="Common.Logging.Log4Net.Log4NetLoggerFactoryAdapter, Common.Logging.Log4net">
Azzieb answered 7/11, 2012 at 20:45 Comment(1)
Thanks for pointing it out. I compared it with a working Quartz example I downloaded and modified it. However, without result.Argal

© 2022 - 2024 — McMap. All rights reserved.