Redeon.SuperSiteEngineCore.Web.Eltheon.Core.Features.Logging
File-based logging uses the registered local logs storage space as its authoritative root. The feature owns the Serilog rolling sink, log queries, retention, and archives; Core.Storage only supplies the policy-bound local data area. Legacy DataAssets/Logs access is used only in standalone compositions where the logs space is not registered.
Overview
This feature collects the log-centric utilities used by the Eltheon runtime. It includes models describing Serilog log lines, a bounded archive workload, and helper factories that expose log metadata to the admin dashboard or external tooling.
Key Pieces
LogEntry,LogShortEntry,LogFileprovide strongly-typed access to log metadata so Razor pages and APIs can filter or present log summaries without parsing raw text.ArchiveLogsJob(logging.archive) archives or removes stale log files below the same resolved root used by the Serilog sink and log viewer.- Factories and middleware make it simple to register archive configuration, expose log endpoints or plug in additional sinks.
- The Logs admin surface is a Pattern-B Razor Class Library: the page shell,
/api/v1/admin/logs/queryAPI, DTOs, typed permission, navigation provider, resources, and feature JavaScript are owned by this package.
Usage
builder.Services.AddArchiveLogsConfig();
builder.Services.AddEltheonLoggingAdmin();
builder.Services.AddRazorPages()
.AddEltheonLoggingApplicationPart();
builder.Services.AddMvc()
.AddEltheonLoggingApplicationPart();
Configure GlobalConfig.LogPath before the host starts so the archive job knows where to look. AddArchiveLogsConfig() contributes the keyed job and its default Workload trigger binding; runtime state and execution history belong to the Workload runtime.
Admin Logs
AddEltheonLoggingAdmin() registers the file-backed query service, the System.Logs.View permission, and the Admin navigation entry. The Razor shell remains available at /Admin/Logs/Index and loads entries through POST /api/v1/admin/logs/query.
The query endpoint supports file selection, text search, level filtering, sorting, server-side paging, compact summary data, and safe diagnostics. Export, delete, and clear actions are intentionally not included because the source page did not provide those operations.
Log queries are bounded by LoggingRuntimeConfig.Viewer:
DefaultPageSizeMaxPageSizeMaxScanLinesMaxReadBytesMaxParseErrorsToKeepEnableChartsEnableLiveRefresh
Malformed lines are counted and returned through query diagnostics. The viewer logs at most one warning per query instead of logging one error per malformed line.
Serilog compact JSON message templates are rendered server-side. The API keeps messageTemplate for diagnostics and returns message for table display, including common properties such as SourceContext, request fields, exception, trace id, span id, request id, and connection id.
The page uses the package static web asset _content/Redeon.SuperSiteEngineCore.Web.Eltheon.Core.Features.Logging/eltheon/features/logs/logs-admin.js. Hosts that consume the package through NuGet must register the application part so the RCL page and API controller are discoverable after pack/install.
Diagnostics
Each archive run is tracked by the Workload runtime under the stable key logging.archive. Enable the logging category Redeon.SuperSiteEngineCore.Web.Eltheon.Core.Features.Logging to observe archive operations or serialization errors when reading log files.
Logging Events
AddArchiveLogsConfig() registers Logging event metadata and a LoggingEventPublisher for targeted failure/configuration paths:
Eltheon.Logging.SinkFailedEltheon.Logging.ConfigurationChanged
Automatic sink wrapping is intentionally deferred until concrete sink failure points exist in this package. Publishers must pass safe identifiers only; log payloads and sink secrets must not be included.
Runtime Logging Config
AddEltheonLoggingRuntimeConfig() registers LoggingRuntimeConfig, the Serilog level switch registry, runtime control, and the config-change event bridge. Hosts can bind Serilog to LoggingLevelSwitchRegistry so Default, Microsoft, System, and Redeon levels can be adjusted without rebuilding the logger pipeline. Request logging and sink structure still depend on host middleware/sink registration and may require restart depending on host wiring.
Metrics
With the Metrik feature enabled and AddMetricsLogging() registered, every log entry of level Warning+ increments:
eltheon_logs_total{severity,category}- counter per log severity and normalized low-cardinality category. The counter is cached and can be disabled throughLoggingRuntimeConfig.MetricsLoggingEnabled.