Bladeren bron

fix:优化日志打印

wang.sq@aliyun.com 7 maanden geleden
bovenliggende
commit
3b6cd1148c
2 gewijzigde bestanden met toevoegingen van 5 en 3 verwijderingen
  1. 5 3
      IMCS_CCS/Service/Impl/TaskJobService.cs
  2. 0 0
      IMCS_CCS/wwwroot/db/Tasks.json

+ 5 - 3
IMCS_CCS/Service/Impl/TaskJobService.cs

@@ -1415,8 +1415,10 @@ namespace IMCS.CCS.Service.Impl
                 foreach (Device device in devices)
                 {
                     Ping pingSender = new Ping();
+
                     // 通过ping的方式测试网络是否联通
-                    PingReply reply = pingSender.Send(device.Ip);
+                    PingReply reply = pingSender.Send(device.Ip, 1000);
+
                     if (reply.Status != IPStatus.Success)
                     {
                         Device oldDevice = await _deviceService.GetDeviceById(device.Id);
@@ -1429,7 +1431,7 @@ namespace IMCS.CCS.Service.Impl
                         }
 
                         Log.Instance.WriteLogAdd(device.Ip + ":" + device.ProtocolType + "连接失败,或已离线", LOG_TITLE_DEVICE);
-                        message = message+ "======设备连接失败,或已离线,ip:" + device.Ip + ",协议类型:" + device.ProtocolType;
+                        message = message+ "======ip:" + device.Ip + "设备连接失败,或已离线,协议类型:" + device.ProtocolType;
                         continue;
                     }
                     else
@@ -1442,7 +1444,7 @@ namespace IMCS.CCS.Service.Impl
                             await _deviceService.UpdateAndCache(oldDevice); 
                         }
                         Log.Instance.WriteLogAdd(device.Ip + ":"+ device.ProtocolType +  "连接成功", LOG_TITLE_DEVICE);
-                        message = message + "======连接成功,ip:" + device.Ip + ",协议类型:" + device.ProtocolType;
+                        message = message + "======ip:" + device.Ip + "连接成功,协议类型:" + device.ProtocolType;
                         continue;
                     }
                     Thread.Sleep(50);

File diff suppressed because it is too large
+ 0 - 0
IMCS_CCS/wwwroot/db/Tasks.json


Some files were not shown because too many files changed in this diff