Logging heartbeats from Umbraco

Umbraco comes with a nice health check feature that can carry out a range of built-in health checks as well as custom checks you may want to add. Umbraco Health Checks fits perfectly with elmah.io Heartbeats.

To start publishing Umbraco Health Checks to elmah.io, create a new health check. Select 1 day in Interval and 5 minutes in Grace. Next, install the Elmah.Io.Umbraco NuGet package:

Install-Package Elmah.Io.Umbraco
dotnet add package Elmah.Io.Umbraco
<PackageReference Include="Elmah.Io.Umbraco" Version="4.*" />
paket add Elmah.Io.Umbraco

For Umbraco to automatically execute health checks, you will need to set your back office URL in the umbracoSettings.config file:

<?xml version="1.0" encoding="utf-8" ?>
  <!-- ... -->
  <web.routing umbracoApplicationUrl="https://localhost:44381/umbraco/">

(localhost used as an example and should be replaced with a real URL)

Umbraco comes with an email publisher already configured. To publish health check results to your newly created heartbeat, extend the HealthChecks.config file:

<?xml version ="1.0" encoding="utf-8" ?>
  <notificationSettings enabled="true" firstRunTime="" periodInHours="24">
      <notificationMethod alias="elmah.io" enabled="true" verbosity="Summary">
          <add key="apiKey" value="API_KEY" />
          <add key="logId" value="LOG_ID" />
          <add key="heartbeatId" value="HEARTBEAT_ID" />
      <notificationMethod alias="email" enabled="false" verbosity="Summary">
          <add key="recipientEmail" value="" />

For this example, I have disabled the email notification publisher but you can run with both if you'd like. Replace API_KEY, LOG_ID, and HEARTBEAT_ID with the values found on the elmah.io UI.

When launching the website Umbraco automatically executes the health checks once every 24 hours and sends the results to elmah.io.

This article was brought to you by the elmah.io team. elmah.io is the best error management system for .NET web applications. We monitor your website, alert you when errors start happening, and help you fix errors fast.

See how we can help you monitor your website for crashes Monitor your website