用Quartz.net记录

编程入门 行业动态 更新时间:2024-10-28 20:17:09
本文介绍了用Quartz记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我会毫不客气地声明我对Log4Net的经验很少.我只是安装了它,但是它不会捕获来自调度数据库Quartz的日志事件.显然Quartz使用Commons Logging,并且需要对其进行配置以指向我的Log4Net设置.不幸的是,它似乎不起作用.感谢您的帮助:

I will shamelessly state that I have little experience with Log4Net. I only just installed it, but it won't capture log events from Quartz, which is a scheduling library. Apparently Quartz uses Commons Logging and that needs to be configured to point to my Log4Net settings. Unfortunately, it doesn't seem to work. Help is appreciated:

<configSections> ... <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" /> <section name="quartz" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.5000.0,Culture=neutral, PublicKeyToken=b77a5c561934e089" /> <section name="commonLogging" type="Common.Logging.ConfigurationSectionHandler, Common.Logging"/> </configSections> <!-- Log4net error handling --> <log4net> <appender name="LogFileAppender" type="log4net.Appender.FileAppender"> <param name="File" value="Admin/LabSlice.log" /> <param name="AppendToFile" value="true" /> <layout type="log4net.Layout.PatternLayout"> <param name="ConversionPattern" value="%d [%t] %-5p %c %m%n" /> </layout> </appender> <root> <level value="INFO" /> <appender-ref ref="LogFileAppender" /> </root> </log4net> <!-- Commons logging (Quart logs) --> <commonLogging> <logging> <factoryAdapter type="Common.Logging.Log4Net.Log4NetLoggerFactoryAdapter, Common.Logging.Log4net"> <arg key="configType" value="INLINE" /> </factoryAdapter> </logging> </commonLogging>

推荐答案

尝试以下配置:

<configSections> .... <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net"/> <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> </configSections> <appSettings> <add key="log4net.Internal.Debug" value="false"/> </appSettings> <common> <logging> <factoryAdapter type="Common.Logging.Log4Net.Log4NetLoggerFactoryAdapter, Common.Logging.Log4Net"> <arg key="configType" value="INLINE"/> <arg key="configFile" value="Trace/application.log.txt"/> <arg key="level" value="ALL" /> </factoryAdapter> </logging> </common> <log4net> <appender name="GeneralLog" type="log4net.Appender.RollingFileAppender"> <file value="Trace/application.log.txt"/> <appendToFile value="true"/> <maximumFileSize value="1024KB"/> <rollingStyle value="Size"/> <layout type="log4net.Layout.PatternLayout"> <conversionPattern value="%d{HH:mm:ss} [%t] %-5p %c - %m%n"/> </layout> </appender> <root> <level value="ALL"/> <appender-ref ref="GeneralLog"/> </root> </log4net>

更多推荐

用Quartz.net记录

本文发布于:2023-11-05 21:08:13,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1561862.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Quartz   net

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!