feat:任务网络请求执行失败新增日志记录

This commit is contained in:
不做码农 2022-06-30 18:14:05 +08:00
parent 32ada25a4a
commit 13f8ec1cec

View File

@ -16,6 +16,7 @@ namespace ZR.Tasks.TaskScheduler
internal class Job_HttpRequest : JobBase, IJob internal class Job_HttpRequest : JobBase, IJob
{ {
private readonly ISysTasksQzService tasksQzService; private readonly ISysTasksQzService tasksQzService;
private readonly NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
public Job_HttpRequest(ISysTasksQzService tasksQzService) public Job_HttpRequest(ISysTasksQzService tasksQzService)
{ {
@ -32,7 +33,11 @@ namespace ZR.Tasks.TaskScheduler
if (info != null) if (info != null)
{ {
var result = await HttpHelper.HttpGetAsync("http://" + info.ApiUrl); var result = await HttpHelper.HttpGetAsync("http://" + info.ApiUrl);
Console.WriteLine(result); logger.Info($"任务【{info.Name}】网络请求执行结果=" + result);
}
else
{
throw new CustomException("任务网络请求执行失败,任务不存在");
} }
} }
} }