public static void Error(string msg, Exception exp) { try { LoadConnectString(); if (exp == null) { exp = new Exception(); } SqlHelper.ExcuteSql(UnityLogConnectString, (c) => { tb_error_log_dal dal = new tb_error_log_dal(); dal.Add(c, new tb_error_log_model() { logcreatetime = DateTime.Now, developer = "车江毅", logtag = "统一监控平台系统异常", logtype = (int)XXF.BaseService.Monitor.SystemRuntime.EnumErrorLogType.SystemError, msg = msg + "【原始信息】" + exp.Message.NullToEmpty(), projectname = "统一监控平台", remark = "", tracestack = exp.StackTrace }); }); Debug.WriteLine(msg + exp.Message); XXF.Log.ErrorLog.Write(msg, exp); } catch (Exception e) { XXF.Log.ErrorLog.Write(msg, e); } }
public static void AddErrorLog(ErrorLogInfo log) { if (XXF.Common.XXFConfig.IsWriteErrorLog && XXF.Common.XXFConfig.IsWriteErrorLogToMonitorPlatform) { try { if (!string.IsNullOrWhiteSpace(Config.UnityLogConnectString)) { SqlHelper.ExcuteSql(Config.UnityLogConnectString, (c) => { tb_error_log_dal errorlogdal = new tb_error_log_dal(); errorlogdal.Add(c, log); }); logbatchqueue.Add(new CommonLogInfo() { logcreatetime = log.logcreatetime, logtag = log.logtag, logtype = log.logtype, msg = log.msg.SubString2(900).NullToEmpty(), projectname = log.projectname }); } } catch (Exception exp) { } } }