diff --git a/src/Umbraco.Core/Configuration/HealthChecks/HealthCheckNotificationSettingsElement.cs b/src/Umbraco.Core/Configuration/HealthChecks/HealthCheckNotificationSettingsElement.cs
index 8c533d9bac..0cb89be12f 100644
--- a/src/Umbraco.Core/Configuration/HealthChecks/HealthCheckNotificationSettingsElement.cs
+++ b/src/Umbraco.Core/Configuration/HealthChecks/HealthCheckNotificationSettingsElement.cs
@@ -24,7 +24,7 @@ namespace Umbraco.Core.Configuration.HealthChecks
}
}
- [ConfigurationProperty(FIRST_RUN_TIME_KEY, IsRequired = true)]
+ [ConfigurationProperty(FIRST_RUN_TIME_KEY, IsRequired = false)]
public string FirstRunTime
{
get
diff --git a/src/Umbraco.Web.UI/web.Template.Debug.config b/src/Umbraco.Web.UI/web.Template.Debug.config
index 5f07e506ec..7e0cf722c8 100644
--- a/src/Umbraco.Web.UI/web.Template.Debug.config
+++ b/src/Umbraco.Web.UI/web.Template.Debug.config
@@ -33,7 +33,7 @@
-
+
diff --git a/src/Umbraco.Web.UI/web.Template.config b/src/Umbraco.Web.UI/web.Template.config
index c271c006c5..75c244ada3 100644
--- a/src/Umbraco.Web.UI/web.Template.config
+++ b/src/Umbraco.Web.UI/web.Template.config
@@ -12,7 +12,7 @@
-
+
diff --git a/src/Umbraco.Web/HealthCheck/HealthCheckResults.cs b/src/Umbraco.Web/HealthCheck/HealthCheckResults.cs
new file mode 100644
index 0000000000..a6a2bca1bd
--- /dev/null
+++ b/src/Umbraco.Web/HealthCheck/HealthCheckResults.cs
@@ -0,0 +1,40 @@
+using System.Collections.Generic;
+using System.Linq;
+using Umbraco.Core.Logging;
+
+namespace Umbraco.Web.HealthCheck
+{
+ public class HealthCheckResults
+ {
+ private readonly Dictionary> _results;
+
+ public HealthCheckResults(IEnumerable checks)
+ {
+ _results = checks.ToDictionary(t => t.Name, t => t.GetStatus());
+ }
+
+ public void LogResults()
+ {
+ LogHelper.Info("Scheduled health check results:");
+ foreach (var result in _results)
+ {
+ var checkName = result.Key;
+ var checkResults = result.Value;
+ var checkIsSuccess = result.Value.All(x => x.ResultType == StatusResultType.Success);
+ if (checkIsSuccess)
+ {
+ LogHelper.Info(string.Format(" Checks for '{0}' all completed succesfully.", checkName));
+ }
+ else
+ {
+ LogHelper.Warn(string.Format(" Checks for '{0}' completed with errors.", checkName));
+ }
+
+ foreach (var checkResult in checkResults)
+ {
+ LogHelper.Info(string.Format(" Result: {0}, Message: '{1}'", checkResult.ResultType, checkResult.Message));
+ }
+ }
+ }
+ }
+}
diff --git a/src/Umbraco.Web/Scheduling/HealthCheckNotifier.cs b/src/Umbraco.Web/Scheduling/HealthCheckNotifier.cs
index 2b8dcd993d..0d39185b99 100644
--- a/src/Umbraco.Web/Scheduling/HealthCheckNotifier.cs
+++ b/src/Umbraco.Web/Scheduling/HealthCheckNotifier.cs
@@ -1,3 +1,5 @@
+using System;
+using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
@@ -51,14 +53,8 @@ namespace Umbraco.Web.Scheduling
var checks = _healthCheckResolver.HealthChecks
.Where(x => disabledCheckIds.Contains(x.Id) == false);
- var sb = new StringBuilder();
- foreach (var check in checks)
- {
- // TODO: get all sub-checks, not just first
- var status = check.GetStatus().First();
- sb.AppendFormat(" - Check {0} returned {1} with message {2}.", check.Name, status.ResultType, status.Message);
- sb.AppendLine();
- }
+ var results = new HealthCheckResults(checks);
+ results.LogResults();
// TODO: get email address and send
if (!string.IsNullOrEmpty(healthCheckConfig.NotificationSettings.RecipientEmail))
@@ -79,9 +75,6 @@ namespace Umbraco.Web.Scheduling
};
slackClient.Post(slackMessage);
}
-
- LogHelper.Info("Health check results:");
- LogHelper.Info(sb.ToString());
}
return true; // repeat
diff --git a/src/Umbraco.Web/Scheduling/Scheduler.cs b/src/Umbraco.Web/Scheduling/Scheduler.cs
index 85a5843486..6e470ad145 100644
--- a/src/Umbraco.Web/Scheduling/Scheduler.cs
+++ b/src/Umbraco.Web/Scheduling/Scheduler.cs
@@ -78,11 +78,21 @@ namespace Umbraco.Web.Scheduling
if (healthCheckConfig.NotificationSettings.Enabled)
{
- var delayInMilliseconds = DateTime.Now.PeriodicMinutesFrom(healthCheckConfig.NotificationSettings.FirstRunTime) * 60 * 1000;
- if (delayInMilliseconds < DelayMilliseconds)
+ // If first run time not set, start with just small delay after application start
+ int delayInMilliseconds;
+ if (string.IsNullOrEmpty(healthCheckConfig.NotificationSettings.FirstRunTime))
{
delayInMilliseconds = DelayMilliseconds;
}
+ else
+ {
+ // Otherwise start at scheduled time
+ delayInMilliseconds = DateTime.Now.PeriodicMinutesFrom(healthCheckConfig.NotificationSettings.FirstRunTime) * 60 * 1000;
+ if (delayInMilliseconds < DelayMilliseconds)
+ {
+ delayInMilliseconds = DelayMilliseconds;
+ }
+ }
var periodInMilliseconds = healthCheckConfig.NotificationSettings.PeriodInHours * 60 * 60 * 1000;
tasks.Add(new HealthCheckNotifier(_healthCheckRunner, delayInMilliseconds, periodInMilliseconds, e.UmbracoContext.Application));
diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj
index e353a38d3b..0deac2daa3 100644
--- a/src/Umbraco.Web/Umbraco.Web.csproj
+++ b/src/Umbraco.Web/Umbraco.Web.csproj
@@ -345,6 +345,7 @@
+