Soenneker.Extensions.LoggerConfiguration
4.0.1343
Prefix Reserved
dotnet add package Soenneker.Extensions.LoggerConfiguration --version 4.0.1343
NuGet\Install-Package Soenneker.Extensions.LoggerConfiguration -Version 4.0.1343
<PackageReference Include="Soenneker.Extensions.LoggerConfiguration" Version="4.0.1343" />
<PackageVersion Include="Soenneker.Extensions.LoggerConfiguration" Version="4.0.1343" />
<PackageReference Include="Soenneker.Extensions.LoggerConfiguration" />
paket add Soenneker.Extensions.LoggerConfiguration --version 4.0.1343
#r "nuget: Soenneker.Extensions.LoggerConfiguration, 4.0.1343"
#:package Soenneker.Extensions.LoggerConfiguration@4.0.1343
#addin nuget:?package=Soenneker.Extensions.LoggerConfiguration&version=4.0.1343
#tool nuget:?package=Soenneker.Extensions.LoggerConfiguration&version=4.0.1343
Soenneker.Extensions.LoggerConfiguration
Configures Soenneker's shared Serilog level switch, rolling file output, optional console output, and an early global bootstrap logger.
Installation
dotnet add package Soenneker.Extensions.LoggerConfiguration
Configure the application logger
using Soenneker.Extensions.LoggerConfiguration;
LoggerConfiguration loggerConfiguration =
await new LoggerConfiguration().ConfigureLogger(configuration);
Log.Logger = loggerConfiguration.CreateLogger();
ConfigureLogger():
- Sets the shared minimum-level switch from
Log:Levels:Default, falling back toLog:DefaultLogLeveland thenInformation. - Enriches events from
LogContext. - Adds a daily rolling file sink with file-size rolling enabled.
- Adds an asynchronous console sink only when
Log:Consoleistrue. - Returns the same
LoggerConfigurationinstance for final composition and logger creation.
It does not assign the finished logger to Log.Logger; the caller does that by calling CreateLogger() as shown above. Call it once per configuration instance—repeated calls add duplicate sinks.
Example configuration:
{
"Log": {
"Console": true,
"Levels": {
"Default": "Information"
}
}
}
The level name is parsed case-insensitively as a Serilog LogEventLevel. An unsupported value throws InvalidOperationException during startup.
Create an early bootstrap logger
await LoggerConfigurationExtension.BuildBootstrapLoggerAndSetGlobally(
DeployEnvironment.Development);
BuildBootstrapLoggerAndSetGlobally() creates a verbose logger with asynchronous console output and rolling file output, assigns it to Log.Logger, and writes a bootstrap event. Use it before the application's complete configuration is available. The DeployEnvironment argument is accepted for API compatibility; this method does not branch on its value.
Because it replaces the global logger, call it once. The caller remains responsible for closing and flushing Serilog during application shutdown.
Log file location
The file name is log-.log; the file sink inserts the rolling date. Set the LOG_PATH environment variable to choose its directory. Without an override, the shared log-path utility selects a writable location for Azure App Service, GitHub Actions, containers, or the application base directory. The resolved path is cached for the process and its directory is created before the sink is configured.
Both setup methods write the resolved log path to standard output. Ensure the chosen directory is writable and mounted persistently when logs must survive container or instance replacement.
Synchronous entry points
BuildBootstrapLoggerAndSetGloballySync() and ConfigureLoggerSync() block until their asynchronous counterparts finish. They are intended for startup entry points that cannot be asynchronous; prefer the ValueTask methods when the caller can await.
| 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
- Serilog.AspNetCore (>= 10.0.0)
- Serilog.Sinks.Async (>= 2.1.0)
- Soenneker.Enums.DeployEnvironment (>= 4.0.235)
- Soenneker.Utils.Logger (>= 4.0.536)
- Soenneker.Utils.LogPath (>= 4.0.133)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on Soenneker.Extensions.LoggerConfiguration:
| Package | Downloads |
|---|---|
|
Soenneker.Coinbase.Runners.OpenApiClients.Cdp
This runner executes a GitHub action that updates another project. It's not meant for consumption. |
|
|
Soenneker.HighLevel.Runners.OpenApiClient
Automatically updates the Soenneker.HighLevel.OpenApiClient package |
|
|
Soenneker.HubSpot.Runners.OpenApiClient
This runner executes a GitHub action that updates another project. It's not meant for consumption. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 4.0.1343 | 0 | 8/30/2026 |
| 4.0.1342 | 0 | 8/30/2026 |
| 4.0.1341 | 0 | 8/30/2026 |
| 4.0.1340 | 0 | 8/30/2026 |
| 4.0.1339 | 0 | 8/30/2026 |
| 4.0.1338 | 0 | 8/30/2026 |
| 4.0.1336 | 127 | 8/29/2026 |
| 4.0.1335 | 77 | 8/29/2026 |
| 4.0.1334 | 93 | 8/29/2026 |
| 4.0.1333 | 3,886 | 8/26/2026 |
| 4.0.1332 | 142 | 8/26/2026 |
| 4.0.1331 | 440 | 8/26/2026 |
| 4.0.1330 | 209 | 8/26/2026 |
| 4.0.1329 | 1,878 | 8/22/2026 |
| 4.0.1328 | 739 | 8/21/2026 |
| 4.0.1327 | 1,507 | 8/21/2026 |
| 4.0.1326 | 4,409 | 8/19/2026 |
| 4.0.1325 | 632 | 8/18/2026 |
| 4.0.1324 | 621 | 8/18/2026 |
| 4.0.1323 | 793 | 8/18/2026 |
Update dependency Soenneker.Utils.Logger to 4.0.536 (#1579)