Structured logging abstractions with HTTP context enrichment for ASP.NET Core applications. Provides consistent logging patterns, correlation IDs, and request/response tracing for better observability in distributed systems.
License
—
Deps
7
Install Size
—
Vulns
✓ 0
Published
Dec 10, 2025
$ dotnet add package SolTechnology.Core.LoggingThe SolTechnology.Core.Logging library provides set of Ilogger extensions working well with Application Insights.
For installing the library, reference SolTechnology.Core.Logging nuget package.
No extra configuration is needed.
builder.Services.AddLogging(c =>
c.AddConsole()
.AddApplicationInsights());
appsettings:
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Information",
"Microsoft": "Information",
"Microsoft.Hosting.Lifetime": "Information"
},
"Debug": {
"LogLevel": {
"Default": "Trace",
"Microsoft.Hosting": "Trace",
"Microsoft": "Trace",
"Microsoft.Hosting.Lifetime": "Trace"
}
},
"ApplicationInsights": {
"sampling": {
"isEnabled": true,
"maxTelemetryItemsPerSecond": 100
},
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Information",
"Microsoft": "Information",
"Microsoft.Hosting.Lifetime": "Information"
}
}
}
using (_logger.BeginOperationScope(new KeyValuePair<string, object>(command.LogScope.OperationIdName, command.LogScope.OperationId)))
_logger.OperationStarted(command.LogScope.OperationName);
_logger.OperationSucceeded(command.LogScope.OperationName);
_logger.OperationFailed(command.LogScope.OperationName, e);
app.UseMiddleware<LoggingMiddleware>();
_logger.AddToScope("userId", userId.ToString() ?? "unknown"),
| Timestamp | Message | CustomDimensions.PlayerId |
|---|---|---|
| 4/11/2022, 12:00:10.738 AM | Operation: [CalculatePlayerStatistics]. Status: [START] | 44 |
| 4/11/2022, 12:00:12.859 AM | Operation: [CalculatePlayerStatistics]. Status: [SUCCESS] | 44 |