PurchaseJob.cs 822 B

123456789101112131415161718192021222324252627282930
  1. using Common.Logging;
  2. using Quartz;
  3. using System;
  4. using System.IO;
  5. using System.Reflection;
  6. namespace Ubtob.Api.JobLibrary
  7. {
  8. class PurchaseJob : IJob
  9. {
  10. private static readonly ILog logger = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
  11. void IJob.Execute(IJobExecutionContext context)
  12. {
  13. try
  14. {
  15. logger.Info("job开始");
  16. using (StreamWriter sw = new StreamWriter("C:\\Users\\Pro1\\log.txt", true))
  17. {
  18. sw.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss ") + " 吃饭---睡觉");
  19. }
  20. logger.Info("job结束");
  21. }
  22. catch (Exception e)
  23. {
  24. logger.Error(e.Message);
  25. }
  26. }
  27. }
  28. }