Logging.ExceptionSender
4.4.0
See the version list below for details.
dotnet add package Logging.ExceptionSender --version 4.4.0
NuGet\Install-Package Logging.ExceptionSender -Version 4.4.0
<PackageReference Include="Logging.ExceptionSender" Version="4.4.0" />
paket add Logging.ExceptionSender --version 4.4.0
#r "nuget: Logging.ExceptionSender, 4.4.0"
// Install Logging.ExceptionSender as a Cake Addin #addin nuget:?package=Logging.ExceptionSender&version=4.4.0 // Install Logging.ExceptionSender as a Cake Tool #tool nuget:?package=Logging.ExceptionSender&version=4.4.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 | net5.0 is compatible. net5.0-windows was computed. 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 was computed. 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. |
.NET Core | netcoreapp3.1 is compatible. |
-
.NETCoreApp 3.1
- Logging.Memory (>= 3.0.1)
- RecurrentTasks (>= 6.5.0)
-
net5.0
- Logging.Memory (>= 3.0.1)
- RecurrentTasks (>= 6.5.0)
-
net6.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 | 567 | 4/25/2024 |
4.4.0 | 546 | 11/10/2023 |
4.3.1 | 160 | 11/3/2023 |
4.3.0 | 203 | 7/26/2023 |
4.2.0 | 2,095 | 4/15/2022 |
4.1.0 | 474 | 4/15/2022 |
4.0.0 | 3,408 | 2/10/2020 |
4.0.0-RC2 | 483 | 12/17/2019 |
4.0.0-RC1 | 419 | 12/16/2019 |
3.5.0 | 1,442 | 10/12/2018 |
3.4.1 | 1,533 | 2/14/2018 |
3.3.0 | 1,995 | 9/14/2017 |
3.2.0 | 1,445 | 2/10/2017 |
3.1.0 | 1,782 | 11/3/2016 |
3.0.0 | 1,101 | 10/31/2016 |
3.0.0-beta2 | 936 | 10/22/2016 |
3.0.0-beta1 | 942 | 10/22/2016 |
2.2.1 | 1,532 | 7/18/2016 |
2.2.0 | 1,290 | 7/15/2016 |
2.1.0 | 1,362 | 6/28/2016 |
2.1.0-preview2 | 1,197 | 5/24/2016 |
2.0.0 | 1,182 | 5/20/2016 |
1.0.0 | 1,624 | 2/8/2016 |
Trim too long log file (use LogFileMaxSize option, default is 10MB).