diff --git a/Web/Services/EmailNotificationService.cs b/Web/Services/EmailNotificationService.cs
index 8897ffd..67fde4f 100644
--- a/Web/Services/EmailNotificationService.cs
+++ b/Web/Services/EmailNotificationService.cs
@@ -15,7 +15,12 @@ namespace LeafWeb.Web.Services
{
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
- private readonly string _emaialFromAddress;
+ private readonly string _emailFromAddress;
+
+ ///
+ /// Comma separated values
+ ///
+ private readonly string _adminEmailAddresses;
private readonly SmtpClient _smtpClient;
@@ -35,7 +40,8 @@ namespace LeafWeb.Web.Services
ConfigurationManager.AppSettings["SmtpPassword"]
);
- _emaialFromAddress = ConfigurationManager.AppSettings["EmailFromAddress"];
+ _emailFromAddress = ConfigurationManager.AppSettings["EmailFromAddress"];
+ _adminEmailAddresses = ConfigurationManager.AppSettings["AdminEmailAddresses"];
}
public EmailNotificationService() : this(new DataService())
@@ -52,6 +58,12 @@ namespace LeafWeb.Web.Services
SendLeafWebSuccess(leafInput);
}
+ public void SendAdministratorMessage(string subject, string body)
+ {
+ var message = new MailMessage(_emailFromAddress, _adminEmailAddresses, subject, body);
+ SendMessage(message);
+ }
+
private void SendLeafWebSuccess(LeafInput leafInput)
{
var fileStreams =
@@ -65,7 +77,7 @@ namespace LeafWeb.Web.Services
body += "Please see the attached results.";
- var message = new MailMessage(_emaialFromAddress, leafInput.Email, "LeafWeb results", body);
+ var message = new MailMessage(_emailFromAddress, leafInput.Email, "LeafWeb results", body);
try
{
@@ -97,7 +109,7 @@ namespace LeafWeb.Web.Services
body += FormatWarningMessage(leafInput);
- var message = new MailMessage(_emaialFromAddress, leafInput.Email, "LeafWeb processing error", body);
+ var message = new MailMessage(_emailFromAddress, leafInput.Email, "LeafWeb processing error", body);
SendMessage(message);
}
diff --git a/Web/Services/PiscalQueueManager.cs b/Web/Services/PiscalQueueManager.cs
index 60bee92..a2a77e8 100644
--- a/Web/Services/PiscalQueueManager.cs
+++ b/Web/Services/PiscalQueueManager.cs
@@ -81,7 +81,12 @@ namespace LeafWeb.Web.Services
}
catch (PiscalClientException ex)
{
- logger.Error("LeafInputFile: {0}, ProcessQueue Exception: {1}", pending.Id, ex.Message);
+ var errorMessage =
+ $"LeafInputFile: {pending.Id}\r\nProcessRunning Exception: {ex.Message}"
+ + $"\r\nInnerException: {ex.InnerException}\r\nStackTrace: {ex.StackTrace}";
+ logger.Error(errorMessage);
+ BackgroundJob.Enqueue(() => _emailService.SendAdministratorMessage("LeafWeb ProcessQueue Exception", errorMessage));
+
_dataService.SetLeafInputStatus(pending, LeafInputStatusType.Exception, "Error occurred starting LeafInput", ex.Message);
logger.Info("LeafInputFile: {0}, Cleanup", pending.Id);
_piscalService.Cleanup(pending);
@@ -140,7 +145,12 @@ namespace LeafWeb.Web.Services
}
catch (Exception ex)
{
- logger.Error("LeafInputFile: {0}, ProcessRunning Exception: {1}\r\n{2}\r\n{3}", leafInput.Id, ex.Message, ex.InnerException, ex.StackTrace);
+ var errorMessage =
+ $"LeafInputFile: {leafInput.Id}\r\nProcessRunning Exception: {ex.Message}"
+ + $"\r\nInnerException: {ex.InnerException}\r\nStackTrace: {ex.StackTrace}";
+ logger.Error(errorMessage);
+ BackgroundJob.Enqueue(() => _emailService.SendAdministratorMessage("LeafWeb ProcessRunning Exception", errorMessage));
+
_dataService.SetLeafInputStatus(leafInput, LeafInputStatusType.Exception, "Error occurred processing LeafInput", ex.Message);
// TODO: Send email
diff --git a/Web/Web.config b/Web/Web.config
index 6205ff4..f15ea80 100644
--- a/Web/Web.config
+++ b/Web/Web.config
@@ -24,6 +24,7 @@
+