?
?
1.App.config
- <?xml version="1.0" encoding="utf-8"?>
- <configuration>
- ??<configSections>
- ????<section
name="log4net"
type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"
/> - ????<sectionGroup
name="common"> - ??????<section
name="logging"
type="Common.Logging.ConfigurationSectionHandler, Common.Logging"
/> - ????</sectionGroup>
- ??</configSections>
- ??<common>
- ????<logging>
- ??????<factoryAdapter
type="Common.Logging.Log4Net.Log4NetLoggerFactoryAdapter, Common.Logging.Log4Net1211"> - ????????<arg
key="configType"
value="INLINE"
/> - ??????</factoryAdapter>
- ????</logging>
- ??</common>
- ??<log4net>
- ????<appender
name="ConsoleAppender"
type="log4net.Appender.ConsoleAppender"> - ??????<layout
type="log4net.Layout.PatternLayout"> - ????????<conversionPattern
value="%d [%t] %-5p %l - %m%n %property{ServiceType}"
/> - ??????</layout>
- ????</appender>
- ????<appender
name="EventLogAppender"
type="log4net.Appender.EventLogAppender"> - ??????<layout
type="log4net.Layout.PatternLayout"> - ????????<conversionPattern
value="%d [%t] %-5p %l - %m%n"
/> - ??????</layout>
- ????</appender>
- ????<appender
name="RollingFileAppenderAll"
type="log4net.Appender.RollingFileAppender"> - ??????<param
name="File"
value="Log/alllLog.txt"
/> - ??????<appendToFile
value="true"
/> - ?
- ??????<!--Make the rolling file name with the date and size-->
- ??????<rollingStyle
value="Composite"
/> - ??????<datePattern
value="yyyyMM"
/> - ??????<maxSizeRollBackups
value="100"
/> - ??????<maximumFileSize
value="2MB"
/> - ?
- ??????<PreserveLogFileNameExtension
value="true"
/> - ??????<staticLogFileName
value="false"
/> - ??????<layout
type="log4net.Layout.PatternLayout"> - ????????<param
name="ConversionPattern"
value="%d %-5p %m%n"
/> - ??????</layout>
- ????</appender>
- ????<root>
- ??????<level
value="INFO"
/> - ??????<appender-ref
ref="ConsoleAppender"
/> - ??????<appender-ref
ref="RollingFileAppenderAll"
/> - ????</root>
- ??</log4net>
- ??<appSettings>
- ????<add
key="aspnet:UseTaskFriendlySynchronizationContext"
value="true"
/> - ??</appSettings>
- ??<system.web>
- ????<compilation
debug="true"
/> - ??</system.web>
- ??<!-- 部署服务库项目时,必须将配置文件的内容添加到
- ??主机的 app.config 文件中。System.Configuration 不支持库的配置文件。-->
- ??<runtime>
- ????<assemblyBinding
xmlns="urn:schemas-microsoft-com:asm.v1"> - ??????<dependentAssembly>
- ????????<assemblyIdentity
name="Common.Logging.Core"
publicKeyToken="af08829b84f0328e"
culture="neutral"
/> - ????????<bindingRedirect
oldVersion="0.0.0.0-3.1.0.0"
newVersion="3.1.0.0"
/> - ??????</dependentAssembly>
- ??????<dependentAssembly>
- ????????<assemblyIdentity
name="Common.Logging"
publicKeyToken="af08829b84f0328e"
culture="neutral"
/> - ????????<bindingRedirect
oldVersion="0.0.0.0-3.1.0.0"
newVersion="3.1.0.0"
/> - ??????</dependentAssembly>
- ????</assemblyBinding>
- ??</runtime>
- <startup><supportedRuntime
version="v4.0"
sku=".NETFramework,Version=v4.5"
/></startup></configuration>
?
2.quartz_jobs.xml
?
- <job-scheduling-data
xmlns="http://quartznet.sourceforge.net/JobSchedulingData"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
version="2.0"> - ??<processing-directives>
- ????<overwrite-existing-data>true</overwrite-existing-data>
- ??</processing-directives>
- ??<schedule>
- ?
- ????<!--清除日志文件-->
- ????<job>
- ??????<name>RemoveLogFileEveryDay</name>
- ??????<group>InnerBusiness</group>
- ??????<description>每天清除两周以前的日志文件</description>
- ??????<job-type>NS.RemoveLogFileEveryDay, NS</job-type>
- ??????<durable>false</durable>
- ??????<recover>true</recover>
- ????</job>
- ????<trigger>
- ??????<cron>
- ????????<name>RemoveLogFileEveryDayTrigger</name>
- ????????<group>RemoveLogFileEveryDayTrigger</group>
- ????????<description>每天23:00点执行一次</description>
- ????????<job-name>RemoveLogFileEveryDay</job-name>
- ????????<job-group>InnerBusiness</job-group>
- ????????<misfire-instruction>DoNothing</misfire-instruction>
- ????????<cron-expression>0 0 23 * * ?</cron-expression>
- ??????</cron>
- ????</trigger>
- ?
- ??</schedule>
- </job-scheduling-data>
?
?
3.quartz.config
- #============================================================================
- # Configure Main Scheduler Properties
- #============================================================================
- org.quartz.scheduler.instanceName = TestScheduler
- org.quartz.scheduler.instanceId = AUTO
- ?
- #============================================================================
- # Configure ThreadPool
- #============================================================================
- org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
- org.quartz.threadPool.threadCount = 20
- org.quartz.threadPool.threadPriority = 5
- ?
- #============================================================================
- # Configure JobStore
- #============================================================================
- org.quartz.jobStore.misfireThreshold = 60000
- org.quartz.jobStore.class = org.quartz.simpl.RAMJobStore
- ?
- #--------------------------------*************plugin配置------------------------------------
- # job initialization plugin handles our xml reading, without it defaults are used
- quartz.plugin.xml.type = Quartz.Plugin.Xml.XMLSchedulingDataProcessorPlugin, Quartz
- quartz.plugin.xml.fileNames = ~/quartz_jobs.xml
- ?
- # export this server to remoting context
- quartz.scheduler.exporter.type = Quartz.Simpl.RemotingSchedulerExporter, Quartz
- quartz.scheduler.exporter.port = 2015
- quartz.scheduler.exporter.bindName = QuartzScheduler
- quartz.scheduler.exporter.channelType = tcp
- quartz.scheduler.exporter.channelName = httpQuartz
?
?
参考: http://www.cnblogs.com/philzhou/archive/2012/11/16/2772533.html
时间: 2024-11-03 02:28:28