public void Intercepte(ActionProxy actionProxy) { logger.Debug("exception interceptor, order:" + Order); try { actionProxy.Execute(); } catch (Exception ex) { logger.Error("ExceptionInterceptor:", ex); string subject = "Action Error, ActionId = " + actionId + ", Exception = " + ex.GetType().Name; StringBuilder mesasge = new StringBuilder(); mesasge.Append("ActionId=").AppendLine(actionId) .Append("Environment=").AppendLine(Environment.MachineName) .Append("Exception Message=").AppendLine(ex.Message) .Append("Exception Trace=").AppendLine(ex.StackTrace) .Append("Exception Source=").AppendLine(ex.Source); string from = notifier; List <string> to = notifiedGroups.ToList(); mailManager.BeginSend(subject, mesasge.ToString(), from, null, to, null, null); throw; } }
public void Intercepte(ActionProxy actionProxy) { logger.Debug("logging interceptor, order:" + Order); ActionLog actionLog = new ActionLog(); actionLog.ActionId = actionId; actionLog.StartDate = DateTime.Now; actionLog.Status = "Start"; if (actionLogger is FileLogger) { string logFile = CreateLogFilePath(actionLog); ((FileLogger)actionLogger).SetLogFile(logFile); actionLog.LogPath = logFile; } actionLogger.Log("Start Executing Action, actionId=" + actionId + ", Environment=" + Environment.MachineName + ", PID=" + Process.GetCurrentProcess().Id); actionLogData.CreateActionLog(actionLog); try { actionProxy.Execute(); actionLog.Status = "Success"; actionLogger.Log("Finish Executing Action"); } catch (Exception ex) { actionLog.Status = "Fail"; actionLogger.Log("Failed Executing Action", ex); throw; } finally { actionLog.EndDate = DateTime.Now; actionLogData.CompleteActionLog(actionLog); actionLogger.Flush(); } }
public void Intercepte(ActionProxy actionProxy) { logger.Info("SampleActionInterceptor, order:" + Order); actionProxy.Execute(); }