Dir*_*rkV 7 c# log4net log4net-configuration common.logging quartz.net-2.0
我正在尝试实现Quartz.Net.只要没有配置日志记录一切正常(调试输出显示"找不到配置部分 - 抑制日志输出").
启用日志记录后,我将收到以下错误:无法从配置部分"common/logging"获取Common.Logging的配置.
内部异常:为common/logging创建配置节处理程序时发生错误:无法创建类型'Common.Logging.Log4Net.Log4NetLoggerFactoryAdapter,Common.Logging.Log4net'
我用了几个资源,这其中以varify我的配置,但据我看到它应该是正确的.
我的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>
Run Code Online (Sandbox Code Playgroud)
我引用了以下程序集:
quartz.dll,版本2.01.100
common.logging.dll,版本2.0.0.0
common.logging.log4net.dll,版本2.0.0.0
log4net.dll,版本1.2.10.0
我找不到给出错误的原因.欢迎所有的帮助,显然我忘记了一些事情......
Slo*_*vic 12
我们有类似的情况,当我们升级到Common.Logging.Log4Net的新版本,其中DLL名称改为Common.Logging.Log4Net1211从Common.Logging.Log4Net.
因此,我们修改了配置文件以更改DLL名称:
<factoryAdapter type="Common.Logging.Log4Net.Log4NetLoggerFactoryAdapter, Common.Logging.Log4Net1211">
Run Code Online (Sandbox Code Playgroud)
无论如何,错误肯定表明缺少DLL.