SSF.Logging.Serilog
2.67.0
dotnet add package SSF.Logging.Serilog --version 2.67.0
NuGet\Install-Package SSF.Logging.Serilog -Version 2.67.0
<PackageReference Include="SSF.Logging.Serilog" Version="2.67.0" />
<PackageVersion Include="SSF.Logging.Serilog" Version="2.67.0" />
<PackageReference Include="SSF.Logging.Serilog" />
paket add SSF.Logging.Serilog --version 2.67.0
#r "nuget: SSF.Logging.Serilog, 2.67.0"
#:package SSF.Logging.Serilog@2.67.0
#addin nuget:?package=SSF.Logging.Serilog&version=2.67.0
#tool nuget:?package=SSF.Logging.Serilog&version=2.67.0
SSF.Logging.Serilog
Structured logging for .NET 10 API, Worker and Console hosts. Application code injects ILogger<T>; the host selects one logging mode.
Quick start
Add a sink to appsettings.json:
{
"Serilog": {
"Using": ["Serilog.Sinks.Console"],
"MinimumLevel": "Information",
"WriteTo": [{ "Name": "Console" }]
}
}
Register Serilog in an API:
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.Logging;
using Serilog;
using SSF.Logging.Serilog.Extensions.DependencyInjection;
var builder = WebApplication.CreateBuilder(args);
builder.AddSSFSerilog(builder.Configuration);
var app = builder.Build();
app.UseSerilogRequestLogging();
app.MapGet("/health", (ILoggerFactory factory) =>
{
factory.CreateLogger("Health").LogInformation("Health checked");
return Results.Ok();
});
await app.RunAsync();
Worker and Console hosts use the same registration on Host.CreateApplicationBuilder(args). Register workers before Build; start/stop and dispose the host normally. See complete examples.
Choose one mode
| Entry point | Logs | Traces / metrics |
|---|---|---|
AddSSFSerilog |
Serilog sinks | Disabled |
AddSSFOpenTelemetry |
Optional SDK logs | Independently selectable |
AddSSFObservability |
Serilog only | Independently selectable SDK signals |
Choose exactly one entry point per builder. Duplicate registration fails. For SDK signals, select Disabled, Console or Otlp; SDK-only mode requires at least one active signal. Combined mode rejects SDK logs. SDK log activation replaces existing logging providers; traces/metrics alone preserve them.
Use Serilog configuration for sinks/levels and SSF:Logging for identity and optional telemetry. Identity defaults to the host application name, entry assembly version and machine name. Override ServiceId for replicas sharing a machine. OTLP requires an explicit collector base URL. See configuration.
Context and application logs
Use structured templates: logger.LogInformation("Processed {Count} entries", count). Custom ILogEventEnricher implementations must be singleton-safe.
Opt into HTTP context with AddSSFRequestLoggingContext and UseSSFRequestLoggingContext; place the middleware after trusted forwarding/authentication and before authorization/request logging. UserId, UserName and UserIp are off by default. Background work uses logger.BeginSSFOperation(...) inside a using scope. See examples.
Implementation and limits
SerilogServiceCollectionExtensionsselects/configures providers; Web overloads delegate to the shared host implementation.LoggingOptionsprepares snapshots and validates options before registration.SSFApplicationEnricheradds cached identity; context middleware adds per-request fields. Internal filters redact named structured secrets. Never log credentials in message text, exceptions or arbitrary objects.- The host owns logger disposal; registration preserves
Log.Logger. Buffered OTLP may drop logs during overflow/outages and is unsuitable for durable audit delivery. - Optional sink/SDK dependencies are still installed when disabled. Worker/Console deployment needs the ASP.NET Core shared framework or a suitable self-contained publish.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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. |
-
net10.0
- Elastic.Serilog.Sinks (>= 9.0.0)
- Microsoft.Data.SqlClient (>= 7.0.2)
- Microsoft.Extensions.DependencyModel (>= 10.0.13)
- OpenTelemetry (>= 1.15.3)
- OpenTelemetry.Exporter.Console (>= 1.15.3)
- OpenTelemetry.Exporter.OpenTelemetryProtocol (>= 1.15.3)
- OpenTelemetry.Extensions.Hosting (>= 1.15.3)
- OpenTelemetry.Instrumentation.AspNetCore (>= 1.15.2)
- OpenTelemetry.Instrumentation.Http (>= 1.15.1)
- Serilog (>= 4.3.1)
- Serilog.AspNetCore (>= 10.0.0)
- Serilog.Enrichers.AspNetCore (>= 1.0.0)
- Serilog.Enrichers.Environment (>= 3.0.1)
- Serilog.Enrichers.Process (>= 3.0.0)
- Serilog.Enrichers.Span (>= 3.1.0)
- Serilog.Enrichers.Thread (>= 4.0.0)
- Serilog.Exceptions (>= 8.4.0)
- Serilog.Settings.Configuration (>= 10.0.1)
- Serilog.Sinks.Console (>= 6.1.1)
- Serilog.Sinks.File (>= 8.0.0-dev-02318)
- Serilog.Sinks.MSSqlServer (>= 9.0.3)
- Serilog.Sinks.OpenTelemetry (>= 4.2.0)
- SSF.Infrastructure.Abstractions (>= 2.67.0)
- System.Security.Cryptography.Pkcs (>= 9.0.21)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on SSF.Logging.Serilog:
| Package | Downloads |
|---|---|
|
SSFFrameworks
SSF Frameworks |
|
|
MicroservisFramework
Created by Sajad Khalili , Sara Arzhang , Omid Janbozorgi |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2.67.0 | 96 | 11/11/2026 |
| 2.66.0 | 89 | 10/17/2026 |
| 2.65.0 | 89 | 10/16/2026 |
| 2.64.0 | 90 | 10/16/2026 |
| 2.63.0 | 93 | 10/9/2026 |
| 2.62.0 | 86 | 10/9/2026 |
| 2.61.0 | 87 | 10/7/2026 |
| 2.60.0 | 92 | 10/6/2026 |
| 2.59.0 | 83 | 10/6/2026 |
| 2.58.0 | 91 | 10/1/2026 |
| 2.57.0 | 86 | 9/29/2026 |
| 2.56.0 | 84 | 9/27/2026 |
| 2.55.0 | 90 | 9/26/2026 |
| 2.54.0 | 96 | 9/26/2026 |
| 2.53.0 | 84 | 9/25/2026 |
| 2.52.0 | 90 | 9/24/2026 |
| 2.51.0 | 80 | 9/24/2026 |
| 2.50.0 | 98 | 9/23/2026 |
| 2.49.0 | 101 | 9/23/2026 |
| 2.48.0 | 93 | 9/23/2026 |