|
@@ -5,6 +5,7 @@ using System.Diagnostics;
|
|
using MECF.Framework.Common.Equipment;
|
|
using MECF.Framework.Common.Equipment;
|
|
using System.Text;
|
|
using System.Text;
|
|
using Aitex.Core.RT.Event;
|
|
using Aitex.Core.RT.Event;
|
|
|
|
+using System.Collections.Generic;
|
|
|
|
|
|
namespace Aitex.Core.RT.Log
|
|
namespace Aitex.Core.RT.Log
|
|
{
|
|
{
|
|
@@ -21,6 +22,9 @@ namespace Aitex.Core.RT.Log
|
|
|
|
|
|
public static ICommonLog InnerLogger { set; private get; }
|
|
public static ICommonLog InnerLogger { set; private get; }
|
|
public static Action<ModuleName> PMErrorInterrupt;
|
|
public static Action<ModuleName> PMErrorInterrupt;
|
|
|
|
+
|
|
|
|
+ private static DateTime _lstErrTime;
|
|
|
|
+ private static Queue<string> _errMessages = new Queue<string>();
|
|
public static void onErrorInterrupt(ModuleName module)
|
|
public static void onErrorInterrupt(ModuleName module)
|
|
{
|
|
{
|
|
if (PMErrorInterrupt != null && ModuleHelper.IsPm(module))
|
|
if (PMErrorInterrupt != null && ModuleHelper.IsPm(module))
|
|
@@ -65,7 +69,24 @@ namespace Aitex.Core.RT.Log
|
|
|
|
|
|
public static void WriteExeption(Exception ex)
|
|
public static void WriteExeption(Exception ex)
|
|
{
|
|
{
|
|
- Write(eEvent.ERR_EXCEPTION, ModuleName.System, GetFormatStackFrameInfo(ex));
|
|
+ if (!_errMessages.Contains(ex.Message))
|
|
|
|
+ {
|
|
|
|
+ if (_errMessages.Count > 30)
|
|
|
|
+ {
|
|
|
|
+ _errMessages.Dequeue();
|
|
|
|
+ _errMessages.Enqueue(ex.Message);
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ _errMessages.Enqueue(ex.Message);
|
|
|
|
+ _lstErrTime = DateTime.Now;
|
|
|
|
+ Write(eEvent.ERR_EXCEPTION, ModuleName.System, GetFormatStackFrameInfo(ex));
|
|
|
|
+ }
|
|
|
|
+ else if (_lstErrTime == null || (DateTime.Now - _lstErrTime).TotalMilliseconds > 10000)
|
|
|
|
+ {
|
|
|
|
+ _lstErrTime = DateTime.Now;
|
|
|
|
+ Write(eEvent.ERR_EXCEPTION, ModuleName.System, GetFormatStackFrameInfo(ex));
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
public static void WriteExeption(string prefix, Exception ex)
|
|
public static void WriteExeption(string prefix, Exception ex)
|