![]() |
VOOZH | about |
dotnet add package Serilog.Sinks.SentrySDK --version 1.0.7.2
NuGet\Install-Package Serilog.Sinks.SentrySDK -Version 1.0.7.2
<PackageReference Include="Serilog.Sinks.SentrySDK" Version="1.0.7.2" />
<PackageVersion Include="Serilog.Sinks.SentrySDK" Version="1.0.7.2" />Directory.Packages.props
<PackageReference Include="Serilog.Sinks.SentrySDK" />Project file
paket add Serilog.Sinks.SentrySDK --version 1.0.7.2
#r "nuget: Serilog.Sinks.SentrySDK, 1.0.7.2"
#:package Serilog.Sinks.SentrySDK@1.0.7.2
#addin nuget:?package=Serilog.Sinks.SentrySDK&version=1.0.7.2Install as a Cake Addin
#tool nuget:?package=Serilog.Sinks.SentrySDK&version=1.0.7.2Install as a Cake Tool
A Serilog sink for Sentry that simplifies error and log management in your applications. It builds on the Sentry .NET SDK and official Serilog integration.
Based on serilog-contrib/serilog-sinks-sentry
π .NET Core Test
π .NET Core CI
π codecov
π GitHub Release
π NuGet Serilog.Sinks.SentrySDK
π NuGet Serilog.Sinks.SentrySDK downloads
π NuGet Serilog.Sinks.SentrySDK.AspNetCore
π NuGet Serilog.Sinks.SentrySDK.AspNetCore downloads
Release 1.0.7.2 on NuGet aligns with GitHub tags such as v1.0.7.2. GitHub Releases carry the changelog and attached .nupkg assets.
| Package | When to use |
|---|---|
| Serilog.Sinks.SentrySDK | Core sink; net6.0 and net10.0 in one package (lib/net6.0/, lib/net10.0/). |
| Serilog.Sinks.SentrySDK.AspNetCore | HTTP context integration and middleware; net6.0 + net10.0. |
| Serilog.Sinks.SentrySDK.6 / Serilog.Sinks.SentrySDK.AspNetCore.6 | Same sink and ASP.NET Core extras; net6.0-only package ids. |
| Serilog.Sinks.SentrySDK.10 / Serilog.Sinks.SentrySDK.AspNetCore.10 | Same functionality; net10.0-only package ids. |
Prefer the main ids unless you want a single target framework per NuGet package id.
Core sink:
dotnet add package Serilog.Sinks.SentrySDK
Install-Package Serilog.Sinks.SentrySDK
ASP.NET Core companion (user/request context in logs):
dotnet add package Serilog.Sinks.SentrySDK.AspNetCore
Install-Package Serilog.Sinks.SentrySDK.AspNetCore
Alternate ids (single TFM per package): Serilog.Sinks.SentrySDK.6, Serilog.Sinks.SentrySDK.10, and matching AspNetCore ids β see Available packages.
This stack references the Sentry NuGet package (6.3.2), the same major line as Sentry for .NET. For DSN, SendDefaultPii, and debug options, see the Quick Start. Initialize as early as possible so startup failures are reported. This sink calls SentrySdk.Init when you configure WriteTo.Sentry with a DSN; avoid a second SentrySdk.Init in the same process unless you deliberately use one initialization path.
Set a valid Sentry DSN in appsettings.json or in code. Without a DSN, the sink throws when the DSN argument is empty. Demos show JSON and programmatic configuration.
Add the sink so logs are sent to Sentry. You can use Serilog.Settings.Configuration with JSON:
{
"Serilog": {
"Using": [ "Serilog.Sinks.SentrySDK" ],
"MinimumLevel": "Debug",
"WriteTo": [
{
"Name": "Sentry",
"Args": {
"dsn": "YOUR_SENTRY_DSN",
"sendDefaultPii": true,
"environment": "Development",
"release": "1.0.7.2",
"attachStacktrace": true,
"tracesSampleRate": 1.0
}
}
],
"Enrich": [ "FromLogContext", "WithMachineName", "WithThreadId" ],
"Properties": {
"Application": "Sample"
}
}
}
var configuration = new ConfigurationBuilder()
.SetBasePath(Directory.GetCurrentDirectory())
.AddJsonFile("appsettings.json")
.Build();
var log = new LoggerConfiguration()
.ReadFrom.Configuration(configuration)
.Enrich.FromLogContext()
.CreateLogger();
log.Error("This error goes to Sentry.");
Optional configureSentryOptions and beforeSend on WriteTo.Sentry map to init-time SentryOptions and a chained SetBeforeSend. A fuller argument list and examples are in the repository README β Getting Started.
Use SetBeforeSend / SetBeforeSendTransaction on SentryOptions for client-side scrubbing; see Scrubbing sensitive data. Prefer the sinkβs optional beforeSend callback for event filtering; use configureSentryOptions for other flags (for example EnableLogs, EnableMetrics) and do not call SetBeforeSend inside that callback, because the sink registers its own SetBeforeSend chain. You can still use Serilog filters and enrichers to limit what reaches the sink.
Install Serilog.Sinks.SentrySDK.AspNetCore, then extend the logger:
var log = new LoggerConfiguration()
.WriteTo.Sentry("YOUR_SENTRY_DSN")
.Enrich.FromLogContext()
.Destructure.With<HttpContextDestructingPolicy>()
.Filter.ByExcluding(e => e.Exception?.CheckIfCaptured() == true)
.CreateLogger();
Register middleware (for example in Startup / pipeline setup):
app.AddSentryContext();
Full snippets, including older Startup.cs examples, are in the repository README β Capturing HttpContext.
This package aligns with Sentry .NET 6.3.2. The repository README maps SentryOptions properties and methods to WriteTo.Sentry parameters (large tables): Sentry SDK and Mapping to WriteTo.Sentry.
Further reading: Data Management, Structured logs, Migration guide.
Full documentation (CI, publishing, formatting): README.md on GitHub.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net6.0 net6.0 is compatible. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 was computed. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
This package is not used by any NuGet packages.
This package is not used by any popular GitHub repositories.
1.0.7.2: includes net6.0 and net10.0. Release notes: https://github.com/antoinebou12/Serilog.Sinks.SentrySDK/releases