Logging.ExceptionSender 5.0.0

dotnet add package Logging.ExceptionSender --version 5.0.0
                    
NuGet\Install-Package Logging.ExceptionSender -Version 5.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Logging.ExceptionSender" Version="5.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Logging.ExceptionSender" Version="5.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Logging.ExceptionSender" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Logging.ExceptionSender --version 5.0.0
                    
#r "nuget: Logging.ExceptionSender, 5.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Logging.ExceptionSender@5.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Logging.ExceptionSender&version=5.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Logging.ExceptionSender&version=5.0.0
                    
Install as a Cake Tool

Logging.ExceptionSender

Watches for unhandled exceptions, saves details to text files in specific folder, starts background task that sends exception info to you (MailGun and Telegram are supported, add your own if needed).

Written for console/worker projects that use RecurrentTasks and for ASP.NET projects (via Logging.ExceptionSender.Web).

NuGet .NET 10.0 .NET 8.0 MIT License

Main features

  • Exception message and stacktrace are captured;
  • Last N log records captured (using Logging.Memory package);
  • Captured data saved in log subdirectory for later processing;
  • Background task (based on RecurrentTasks) checks new exception data;
  • Every single exception - one message to you;
  • Uses MailGun to send emails (free quota 10K emails/month) or Telegram
  • Add your own provider by inheriting from ExceptionSenderTask;
  • When new exception is caught - tries to send immediately;
  • When message sucessfully sent - files are deleted from disk;
  • Can send emails to multiple recipients (multiple To).

Installation

Use NuGet package Logging.ExceptionSender for console/worker projects, or Logging.ExceptionSender.Web for web projects.

Usage

See Sample project.

1. Register at MailGun.com or create a Telegram bot

Put values into appsettings file:

{
  "ExceptionSender": {
    // For Mailgun
    "MailgunDomain": "example.com",
    "MailgunApiKey": "key-*************",
    "From": "myapp@example.com",
    "To": [ "admin1@example.com", "admin2@example.com" ],

    // For Telegram
    "ChatId": "",
    "BotToken": ""
  }
}

2. Register sender service

services.AddMailgunExceptionSender(Configuration.GetSection("ExceptionSender"));
// or
services.AddTelegramExceptionSender(Configuration.GetSection("ExceptionSender"));

3. Attach catch service

Append .WithExceptionSender() to task configuration:

services.AddTask<SomeTask>(o => o.AutoStart(...).WithExceptionSender());

Append .UseExceptionSender() to aspnet request pipeline:

app.UseExceptionSender();

4: Enable MemoryLogger with desired log level

var loggerFactory = app.Services.GetRequiredService<ILoggerFactory>();
loggerFactory.AddMemory(LogLevel.Debug);

Dependencies

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Logging.ExceptionSender:

Package Downloads
ExceptionSenderSmtp

Package Description

Logging.ExceptionSender.Web

Web adapter for ExceptionSender to catch unhandled pipeline errors.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
5.0.0 132 1/17/2026
4.5.0 1,103 4/25/2024
4.4.0 615 11/10/2023
4.3.1 224 11/3/2023
4.3.0 301 7/26/2023
4.2.0 2,263 4/15/2022
4.1.0 657 4/15/2022
4.0.0 3,606 2/10/2020
4.0.0-RC2 666 12/17/2019
4.0.0-RC1 608 12/16/2019
3.5.0 1,671 10/12/2018
3.4.1 2,072 2/14/2018
3.3.0 2,410 9/14/2017
3.2.0 1,818 2/10/2017
3.1.0 2,350 11/3/2016
3.0.0 1,649 10/31/2016
3.0.0-beta2 1,479 10/22/2016
3.0.0-beta1 1,493 10/22/2016
2.2.1 2,237 7/18/2016
2.2.0 2,040 7/15/2016
2.1.0 2,076 6/28/2016
2.1.0-preview2 1,913 5/24/2016
2.0.0 1,745 5/20/2016
1.0.0 2,708 2/8/2016