GenericLogger.AspNetCore
1.2.0
dotnet add package GenericLogger.AspNetCore --version 1.2.0
NuGet\Install-Package GenericLogger.AspNetCore -Version 1.2.0
<PackageReference Include="GenericLogger.AspNetCore" Version="1.2.0" />
<PackageVersion Include="GenericLogger.AspNetCore" Version="1.2.0" />
<PackageReference Include="GenericLogger.AspNetCore" />
paket add GenericLogger.AspNetCore --version 1.2.0
#r "nuget: GenericLogger.AspNetCore, 1.2.0"
#:package GenericLogger.AspNetCore@1.2.0
#addin nuget:?package=GenericLogger.AspNetCore&version=1.2.0
#tool nuget:?package=GenericLogger.AspNetCore&version=1.2.0
GenericLogger
GenericLogger is a drop-in ASP.NET Core logging provider with durable structured logs and an embedded, live web dashboard. The package targets net8.0, so it can be installed in ASP.NET Core 8, 9, and 10 applications.
Features
- Standard
Microsoft.Extensions.Loggingintegration—existingILogger<T>calls work unchanged - Structured values, scopes, exception stacks, event IDs, and W3C trace/span correlation
- Asynchronous bounded ingestion so request threads do not perform file I/O
- Daily newline-delimited JSON files with size-based rotation and automatic retention
- Responsive embedded UI at a configurable URL; no separate frontend deployment
- Full-text/category/level/trace filtering, event detail inspection, aggregate cards, and CSV export
- Protected storage management UI with file inventory, downloads, age-based cleanup, and confirmed deletion
- Server-Sent Events live monitoring with automatic reconnect
- Configurable category levels, secret redaction, query caps, and API-key protection
- No third-party runtime dependencies or database server
Install and use
When published to your feed, install the package:
dotnet add package GenericLogger.AspNetCore
Register it in Program.cs:
using GenericLogger;
var builder = WebApplication.CreateBuilder(args);
builder.Logging.AddGenericLogger(options =>
{
options.DashboardPath = "/logui";
options.LogDirectory = Path.Combine(builder.Environment.ContentRootPath, "logs");
options.MinimumLevel = LogLevel.Information;
options.RetentionDays = 30;
options.MaxFileSizeBytes = 25 * 1024 * 1024;
options.CategoryMinimumLevels["Microsoft.AspNetCore"] = LogLevel.Warning;
options.DashboardUsername = builder.Configuration["LogUI:Username"] ?? "developer";
options.DashboardPassword = builder.Configuration["LogUI:Password"];
options.ApiKey = builder.Configuration["LogUI:ApiKey"]; // Optional automation access
});
var app = builder.Build();
app.MapGenericLoggerDashboard();
app.Run();
Open /logui and sign in. Store LogUI:Password in environment variables, .NET user-secrets, a vault, or your deployment platform—not in source control. If neither DashboardPassword nor ApiKey is configured, the dashboard is unprotected.
Your existing structured logging automatically appears:
logger.LogInformation("Order {OrderId} shipped to {Country}", order.Id, order.Country);
logger.LogError(exception, "Payment failed for {CustomerId}", customer.Id);
Configuration
| Option | Default | Purpose |
|---|---|---|
DashboardPath |
/logui |
UI and API route prefix |
LogDirectory |
{AppBase}/logs |
Durable NDJSON file location |
MinimumLevel |
Information |
Global minimum level |
CategoryMinimumLevels |
empty | Per-category prefix overrides |
RetentionDays |
30 |
Age after which log files are deleted |
MaxFileSizeBytes |
25 MB |
Rotation threshold per file |
ChannelCapacity |
10,000 |
In-memory ingestion buffer |
QueryLimit |
500 |
Server-side maximum events per request |
ApiKey |
unset | Optional dashboard/API secret |
DashboardUsername |
developer |
Static login username for this API |
DashboardPassword |
unset | Static login password; enables the login screen |
SessionDuration |
8 hours |
Lifetime of the encrypted login cookie |
RedactedProperties |
common secret names | Structured keys whose values become [REDACTED] |
Endpoints
All endpoints are beneath DashboardPath: / dashboard, /api/logs search, /api/summary aggregates, /api/export CSV, /api/stream live SSE, and protected /api/storage, /api/files, and /api/cleanup storage-management endpoints. Query parameters include from, to, level, category, search, traceId, and limit.
Use Manage in the dashboard to inspect disk usage, download individual NDJSON files, delete a selected file, clean up files older than a chosen number of days, or delete all logs. Destructive operations require explicit confirmation and an authenticated dashboard session.
Run this repository
dotnet build GenericLogger.slnx
dotnet run --project samples/GenericLogger.SampleApi
Then browse to the URL printed by ASP.NET Core and append /logui. Generate sample events with /demo/Ada and /demo/error.
Production notes
Mount LogDirectory on persistent storage in containers. Use a random API key and HTTPS, or place /logui behind your existing authentication proxy. NDJSON is ideal for a single application instance and moderate traffic; for high-volume distributed search, use the provider as a foundation for a centralized storage adapter.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. 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. |
-
net8.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.