Commit e9880b04 LN

错误日志重新定义

1 个父辈 6a892985
......@@ -323,7 +323,7 @@ namespace OnlineStore.Common
catch (Exception ex)
{
isOk = false;
LogUtil.error( "SendCommand ERROR:" + ex.ToString(),1020);
LogUtil.error( "SendCommand ERROR:" + ex.ToString(),108);
}
finally
{
......
......@@ -61,7 +61,9 @@ namespace OnlineStore.Common
{
rfidLog.Debug(msg);
}
public static void error(string errorMsg, int type,int seconds=10)
public static void error(string errorMsg, int type, int seconds = 10)
{
try
{
if (lastErrorLogTime.ContainsKey(type))
{
......@@ -79,6 +81,11 @@ namespace OnlineStore.Common
error(LOGGER, errorMsg);
}
}
catch (Exception ex)
{
LOGGER.Error(" 打印日志【" + type + "-" + errorMsg + "】出错:" + ex.ToString());
}
}
public static void error(ILog log, string errorMsg, Exception ex = null)
{
if (errorMsg.Trim().Equals("")&&(ex==null))
......
......@@ -112,7 +112,7 @@ namespace OnlineStore.Common
}
catch (Exception e)
{
LogUtil.error("POST ERROR:" + e.ToString(), 1001);
LogUtil.error("POST ERROR:" + e.ToString(), 101);
}
if (!result.Contains("null") && result.Length != 0)
{
......@@ -146,7 +146,7 @@ namespace OnlineStore.Common
}
catch (Exception e)
{
LogUtil.error("HTTP GET ERROR:" + e.Message, 1002);
LogUtil.error("HTTP GET ERROR:" + e.Message, 102);
}
return "";
}
......
......@@ -119,7 +119,7 @@ namespace OnlineStore.Common
}
catch (Exception ex)
{
LogUtil.error( "Connect to " + serverIP + ":" + serverPort + " fail!" + ex.ToString(), 1003);
LogUtil.error( "Connect to " + serverIP + ":" + serverPort + " fail!" + ex.ToString(), 103);
//m_clientSocket = null;
}
}
......@@ -233,7 +233,7 @@ namespace OnlineStore.Common
}
catch (Exception ex)
{
LogUtil.error( "socket received error:" + ex.ToString(), 1004);
LogUtil.error( "socket received error:" + ex.ToString(), 104);
}
}
}
......
......@@ -166,11 +166,11 @@ namespace OnlineStore.Common
}
catch (SocketException e)
{
LogUtil.error("客户端{" + client.AddStr + "]:" + e.ToString(), 1006);
LogUtil.error("客户端{" + client.AddStr + "]:" + e.ToString(), 106);
}
catch (Exception ex)
{
LogUtil.error("客户端{" + client.AddStr + "]:" + ex.ToString(), 1005);
LogUtil.error("客户端{" + client.AddStr + "]:" + ex.ToString(), 105);
}
}
//private void ReceiveMessages(Client client)
......
......@@ -410,7 +410,7 @@ namespace OnlineStore.DeviceLibrary
Alarm(LineAlarmType.AxisMoveError);
CheckAlarmProcess(moveInfo, LineAlarmType.AxisMoveError);
LogUtil.error(WarnMsg, DeviceID + 18);
LogUtil.error(WarnMsg, DeviceID * 1000 + 14);
break;
}
}
......@@ -429,7 +429,7 @@ namespace OnlineStore.DeviceLibrary
ConfigIO io = baseConfig.getWaitIO(wait.IoType);
WarnMsg = moveInfo.Name + "[" + moveInfo.MoveType + "][" + moveInfo.MoveStep + "] 等待" + NotOkMsg + " 超时 " + Math.Round(span.TotalSeconds, 1) + "秒";
LogUtil.error(MoveInfo.Name + WarnMsg, DeviceID + 13);
LogUtil.error(MoveInfo.Name + WarnMsg, DeviceID * 1000 + 13);
if (NoAlarm())
{
Alarm(LineAlarmType.IoSingleTimeOut);
......@@ -527,7 +527,7 @@ namespace OnlineStore.DeviceLibrary
{
second = 10;
}
LogUtil.error(WarnMsg, DeviceID + 15, second);
LogUtil.error(WarnMsg, DeviceID * 1000 + 15, second);
Alarm(LineAlarmType.IoSingleTimeOut);
CheckAlarmProcess(moveInfo, LineAlarmType.IoSingleTimeOut);
}
......
......@@ -441,7 +441,7 @@ namespace OnlineStore.DeviceLibrary
else if (SecondMoveInfo.IsTimeOut(60))
{
WarnMsg = SecondMoveInfo.Name + "[" + SecondMoveInfo.MoveStep + "] 等待出库移栽超时 [" + Math.Round(MoveInfo.StepSpan().TotalSeconds, 1) + "]秒";
LogUtil.error(WarnMsg, DeviceID + 11);
LogUtil.error(WarnMsg, DeviceID * 1000 + 21);
Alarm(LineAlarmType.IoSingleTimeOut);
}
}
......@@ -892,7 +892,7 @@ namespace OnlineStore.DeviceLibrary
else if (MoveInfo.IsTimeOut(180))
{
WarnMsg = MoveInfo.Name + "[" + MoveInfo.MoveType + "][" + MoveInfo.SLog + "]等待空托盘到达超时[" + Math.Round(MoveInfo.StepSpan().TotalSeconds, 1) + "]秒";
LogUtil.error(WarnMsg, DeviceID + 12);
LogUtil.error(WarnMsg, DeviceID * 1000 + 22);
Alarm(LineAlarmType.IoSingleTimeOut);
}
//送出料架处理
......@@ -1323,19 +1323,19 @@ namespace OnlineStore.DeviceLibrary
//判断是否有料架,是否可以出库
if (IOValue(IO_Type.SL_Location_Check).Equals(IO_VALUE.LOW))
{
LogUtil.error(Name + " 【" + info.ToStr() + "】需要出库,定位工位无料架,暂不处理", DeviceID + 16);
LogUtil.error(Name + " 【" + info.ToStr() + "】需要出库,定位工位无料架,暂不处理", DeviceID * 1000 + 16);
return false;
}
else if (OutStoreHeight < 0)
{
LogUtil.error(Name + " 【" + info.ToStr() + "】需要出库,料架未准备好,暂不处理", DeviceID + 17);
LogUtil.error(Name + " 【" + info.ToStr() + "】需要出库,料架未准备好,暂不处理", DeviceID * 1000 + 17);
return false;
}
//如果已经开始送出料架,暂不处理
if (MoveInfo.MoveType.Equals(LineMoveType.OutStore)&& MoveInfo.MoveStep >= LineMoveStep.FO_30_BatchAxisToP2)
{
LogUtil.error(Name + " 【" + info.ToStr() + "】需要出库,正在送出料架,暂不处理", DeviceID + 18);
LogUtil.error(Name + " 【" + info.ToStr() + "】需要出库,正在送出料架,暂不处理", DeviceID * 1000 + 18);
return false;
}
......
......@@ -909,7 +909,7 @@ namespace OnlineStore.DeviceLibrary
if (span.TotalSeconds > LineManager.Config.IOSingle_TimerOut * 2)
{
SetWarnMsg(moveEquip.Name + "下降阻挡气缸超时,已等待" + FormUtil.GetSpanStr(span));
LogUtil.error(moveEquip.Name + "下降阻挡气缸超时,已等待" + FormUtil.GetSpanStr(span), 112);
LogUtil.error(moveEquip.Name + "下降阻挡气缸超时,已等待" + FormUtil.GetSpanStr(span), 902);
}
else if (rwSpan.TotalSeconds > 5 && span.TotalSeconds > 6 && span.TotalSeconds < LineManager.Config.IOSingle_TimerOut * 2)
{
......@@ -970,7 +970,7 @@ namespace OnlineStore.DeviceLibrary
else if (span.TotalSeconds > 120)
{
WarnMsg = Name + "[" + MoveInfo.MoveStep + "][" + msg + "]已等待[" + Math.Round(span.TotalSeconds, 1) + "]秒";
LogUtil.error(WarnMsg, 100);
LogUtil.error(WarnMsg, 903);
Alarm(LineAlarmType.IoSingleTimeOut);
}
}
......
......@@ -107,7 +107,7 @@ namespace OnlineStore.DeviceLibrary
ConfigIO io = baseConfig.getWaitIO(wait.IoType);
WarnMsg = Name + "[" + checkWaitInfo.MoveStep + "]等待" + NotOkMsg + " 超时";
Alarm(LineAlarmType.IoSingleTimeOut);
LogUtil.error(MoveInfo.Name + WarnMsg, DeviceID + 13);
LogUtil.error(MoveInfo.Name + WarnMsg, 901);
}
//超过报警时长
else if (rwSpan.TotalSeconds > 5 && span.TotalSeconds > 6 && span.TotalSeconds < LineManager.Config.IOSingle_TimerOut * 2)
......@@ -182,7 +182,7 @@ namespace OnlineStore.DeviceLibrary
else if (span.TotalSeconds > checkWaitInfo.TimeOutSeconds)
{
WarnMsg = checkWaitInfo.Name + "[" + checkWaitInfo.MoveStep + "][" + NotOkMsg + "]已等待[" + Math.Round(span.TotalSeconds, 1) + "]秒";
LogUtil.error(WarnMsg, 100);
LogUtil.error(WarnMsg, 900);
Alarm(LineAlarmType.IoSingleTimeOut);
}
}
......
......@@ -204,7 +204,7 @@ namespace OnlineStore.DeviceLibrary
else if (MoveInfo.IsTimeOut(180))
{
WarnMsg = MoveInfo.Name + "[" + MoveInfo.MoveType + "][" + MoveInfo.SLog + "]等待空托盘到达超时[" + Math.Round(MoveInfo.StepSpan().TotalSeconds, 1) + "]秒";
LogUtil.error(WarnMsg, DeviceID + 12);
LogUtil.error(WarnMsg, DeviceID * 1000 + 12);
Alarm(LineAlarmType.IoSingleTimeOut);
return false;
}
......
......@@ -61,7 +61,7 @@ namespace OnlineStore.DeviceLibrary
{
if (LastTrayPosition <= 1)
{
LogUtil.error(Name + " 启动送料【" + moveParam.ToStr() + "】 失败,入口有料" , Id + 32);
LogUtil.error(Name + " 启动送料【" + moveParam.ToStr() + "】 失败,入口有料" , Id * 1000 + 32);
return false;
}
//MoveInfo.MoveParam = moveParam;
......@@ -102,7 +102,7 @@ namespace OnlineStore.DeviceLibrary
}
else
{
LogUtil.error(Name + " 启动送料【" + moveParam.ToStr() + "】 失败", Id + 31);
LogUtil.error(Name + " 启动送料【" + moveParam.ToStr() + "】 失败", Id * 1000 + 31);
return false;
}
}
......@@ -142,7 +142,7 @@ namespace OnlineStore.DeviceLibrary
}
else if (MoveInfo.IsTimeOut(180))
{
LogUtil.error(Name + "等待入口无料超时" + FormUtil.GetSpanStr(MoveInfo.StepSpan()), Id + 33);
LogUtil.error(Name + "等待入口无料超时" + FormUtil.GetSpanStr(MoveInfo.StepSpan()), Id * 1000 + 33);
}
}
......
......@@ -541,7 +541,7 @@ namespace OnlineStore.DeviceLibrary
else if (MoveInfo.IsTimeOut())
{
WarnMsg = MoveInfo.Name + "[" + MoveInfo.MoveType + "][" + MoveInfo.MoveStep + "]等待 皮带线可放料 " + "超时[" + Math.Round(MoveInfo.StepSpan().TotalSeconds, 1) + "]秒";
LogUtil.error(WarnMsg, DeviceID + 20);
LogUtil.error(WarnMsg, DeviceID * 1000 + 20);
Alarm(LineAlarmType.IoSingleTimeOut);
}
}
......
......@@ -155,7 +155,7 @@ namespace OnlineStore.DeviceLibrary
{
msg = " " + MoveInfo.SLog + MoveInfo.Name + axis.DisplayStr + ",目标位置[" + targetPosition + "]当前位置[" + outCount
+ "],误差过大,需要报警";
LogUtil.error(msg, 1034);
LogUtil.error(msg, 600);
}
}
return false;
......
......@@ -280,11 +280,11 @@ namespace OnlineStore.DeviceLibrary
{
if (msg.StartsWith(Name))
{
LogUtil.error(msg, 105);
LogUtil.error(msg, 801);
}
else
{
LogUtil.error(Name + msg, 105);
LogUtil.error(Name + msg, 801);
}
}
else
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!