Logging.ExceptionSender
4.5.0
dotnet add package Logging.ExceptionSender --version 4.5.0
NuGet\Install-Package Logging.ExceptionSender -Version 4.5.0
<PackageReference Include="Logging.ExceptionSender" Version="4.5.0" />
paket add Logging.ExceptionSender --version 4.5.0
#r "nuget: Logging.ExceptionSender, 4.5.0"
// Install Logging.ExceptionSender as a Cake Addin #addin nuget:?package=Logging.ExceptionSender&version=4.5.0 // Install Logging.ExceptionSender as a Cake Tool #tool nuget:?package=Logging.ExceptionSender&version=4.5.0
Logging.ExceptionSender
ExceptionSenderMiddleware
watches for unhandled exceptions. When found - details are saved to text files in specific folder.
ExceptionSenderTask
monitors that folder and sends exception info to you by email (using MailGun.com, but you can add your own)
Written for ASP.NET Core (ASP.NET 5, ASP.NET vNext) projects.
Main features
- Exception message and stacktrace are captured;
- Last N log records captured (Logging.Memory is used);
- Captured data saved in
logs
subdirectory for later processing; - Task (based on RecurrentTasks) is used for checking new exception data;
- Every single exception - one email to you;
- MailGun is used to send emails (free quota 10K emails/month), you can add new mail providers (inherit from
ExceptionSenderTask
); - When new exception is caught - tries to send immediately;
- When message sucessfully sent - files are deleted from disk;
- Can send message to multiple recipients (multiple
To
)
Installation
Use NuGet package Logging.ExceptionSender
Dependencies
Usage
1. Register at MailGun.com (if needed)
If you wish to use MailGun
for sending mail, you need to create account (or use existing one, if any).
Register your site at MailGun.com and write down your domain name and api key:
2. Configure/initialize in Startup.cs
Sample (minimum) configuration in config.json
(aka appsettings.json
):
{
...
"ExceptionSender": {
"MailgunBaseUrl": "https://api.mailgun.net/v3/", // some accounts need https://api.eu.mailgun.net/v3/
"MailgunDomain": "example.com",
"MailgunApiKey": "key-*************",
"From": "myapp@example.com",
"To": ["admin1@example.com", "admin2@example.com"]
}
...
}
In ConfigureServices
method of your Startup.cs
:
services.AddMailgunExceptionSender(Configuration.GetSection("ExceptionSender"));
In Configure
method of your Statup.cs
:
// Enable in-memory logging
loggerFactory.AddMemory();
// Activate ExceptionSender middleware to catch ASP exceptions
app.UseExceptionSender();
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. 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. |
-
net6.0
- Logging.Memory (>= 3.0.1)
- RecurrentTasks (>= 6.5.0)
-
net8.0
- Logging.Memory (>= 3.0.1)
- RecurrentTasks (>= 6.5.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Logging.ExceptionSender:
Package | Downloads |
---|---|
ExceptionSenderSmtp
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
4.5.0 | 616 | 4/25/2024 |
4.4.0 | 556 | 11/10/2023 |
4.3.1 | 167 | 11/3/2023 |
4.3.0 | 208 | 7/26/2023 |
4.2.0 | 2,101 | 4/15/2022 |
4.1.0 | 480 | 4/15/2022 |
4.0.0 | 3,416 | 2/10/2020 |
4.0.0-RC2 | 485 | 12/17/2019 |
4.0.0-RC1 | 421 | 12/16/2019 |
3.5.0 | 1,453 | 10/12/2018 |
3.4.1 | 1,544 | 2/14/2018 |
3.3.0 | 2,007 | 9/14/2017 |
3.2.0 | 1,455 | 2/10/2017 |
3.1.0 | 1,794 | 11/3/2016 |
3.0.0 | 1,111 | 10/31/2016 |
3.0.0-beta2 | 941 | 10/22/2016 |
3.0.0-beta1 | 947 | 10/22/2016 |
2.2.1 | 1,544 | 7/18/2016 |
2.2.0 | 1,304 | 7/15/2016 |
2.1.0 | 1,374 | 6/28/2016 |
2.1.0-preview2 | 1,202 | 5/24/2016 |
2.0.0 | 1,192 | 5/20/2016 |
1.0.0 | 1,636 | 2/8/2016 |
Add net8.0; Drop out-of-support frameworks; Add ExceptionSenderTelegramOptions.AppNameSuffix.