using Common.Logging; using Quartz; using System; using System.IO; using System.Reflection; namespace Ubtob.Api.JobLibrary { class PurchaseJob : IJob { private static readonly ILog logger = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); void IJob.Execute(IJobExecutionContext context) { try { logger.Info("job开始"); using (StreamWriter sw = new StreamWriter("C:\\Users\\Pro1\\log.txt", true)) { sw.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss ") + " 吃饭---睡觉"); } logger.Info("job结束"); } catch (Exception e) { logger.Error(e.Message); } } } }