Syntrony.Logging
1.1.0
dotnet add package Syntrony.Logging --version 1.1.0
NuGet\Install-Package Syntrony.Logging -Version 1.1.0
<PackageReference Include="Syntrony.Logging" Version="1.1.0" />
<PackageVersion Include="Syntrony.Logging" Version="1.1.0" />
<PackageReference Include="Syntrony.Logging" />
paket add Syntrony.Logging --version 1.1.0
#r "nuget: Syntrony.Logging, 1.1.0"
#:package Syntrony.Logging@1.1.0
#addin nuget:?package=Syntrony.Logging&version=1.1.0
#tool nuget:?package=Syntrony.Logging&version=1.1.0
Syntrony.Logging
Unified logging and telemetry package for Syntrony services: a single UseLogging entry point to configure the
sink (Log4Net today, Serilog planned) and backend-agnostic OpenTelemetry-based telemetry. No sink is pulled in
unless its own package is referenced and its Use* extension is called.
builder.Services.AddSyntrony(options =>
{
options.UseLogging(log => log
.SetMinimumLevel(LogLevel.Information)
.WithEnrichment(p => p["service.name"] = "my-service")
.UseLog4Net()
.UseOpenTelemetry(otel =>
{
otel.ServiceName = "my-service";
otel.Endpoint = builder.Configuration["Telemetry:OtlpEndpoint"];
}));
});
What's in this package
UseLogging(this SyntronyOptions, Action<ISyntronyLoggingBuilder>? configure = null)— the entry point. Calling it more than once on the sameSyntronyOptionsreuses the same builder, so the calls compose instead of replacing each other's configuration. Calling it without a sink keeps the host's own providers (console, debug, event source); it does still install the default filter rules described in Default output.ISyntronyLoggingBuilder— what sink packages (Syntrony.Logging.Log4Net,Syntrony.Logging.OpenTelemetry) build theirUse*extension on top of:Logging(ILoggingBuilder) /Services(IServiceCollection) — the host's logging builder and DI container, for anything a sink needs directly.SetMinimumLevel(LogLevel)— no-ops if the host already has an explicitLogging:LogLevelconfiguration; this package never overrides what the host already set.WithEnrichment(Action<IDictionary<string, object>>)— accumulates properties a sink applies to every log entry (service name, version, environment). Callbacks run in registration order.RegisterStructuredSink(string)— called by a structured sink (UseLog4Net, eventuallyUseSerilog) to claim the sink slot. Throws if a different sink already claimed it — they're mutually exclusive, pick one. The first time it is called it removes the host's default providers (console, debug, event source, event log), so every entry is written once, by the sink. Other packages' providers are left alone. Telemetry sinks (UseOpenTelemetry) don't call this; they compose with whichever structured sink is active.
GetRegisteredInstance<T>()(internal helper,ServiceCollectionInstanceExtensions) — resolves a singleton the host already registered as an instance (IConfiguration,IHostEnvironment) without building the container, since sink packages need it at registration time, before the app has a builtIServiceProvider.
Default output
UseLogging installs these filter rules. They sit first in the rule list, so any rule the host
(Logging:LogLevel in appsettings.json) or your code (AddFilter) sets for the same category wins.
| Category | Default level | What it lets through |
|---|---|---|
Microsoft |
Warning |
Framework warnings and errors only |
Microsoft.AspNetCore |
Warning |
No per-request routing, MVC or hosting lines |
Microsoft.Hosting.Lifetime |
Information |
Now listening on:, environment, content root |
Microsoft.EntityFrameworkCore.Database.Command |
Information |
Every SQL command EF Core runs, with its duration |
The longest matching category wins, so to silence the SQL you need the category itself:
{ "Logging": { "LogLevel": { "Microsoft.EntityFrameworkCore.Database.Command": "Warning" } } }
Microsoft.EntityFrameworkCore: Warning is not enough: it is shorter than the default for the SQL category.
Parameter values are printed as @p0='?'; they only appear if you call EnableSensitiveDataLogging(), which you
should not do in production.
One entry, one line
With UseLog4Net() the host's console provider is removed, so each entry is written once, in the log4net
layout. If you also want the console provider, add it after the sink:
options.UseLogging(log =>
{
log.UseLog4Net();
log.Logging.AddConsole(); // after UseLog4Net — before it, it would be removed
});
Settings keyed by provider, such as Logging:Console:LogLevel, no longer apply once the console provider is gone.
No IHostedService involved: the only asynchronous piece — initializing the core's LogHelper once the
container is built — runs through SyntronyOptions.AddInitializer, the same deferred-initialization pipeline
every other Syntrony package uses.
| 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
- Microsoft.Extensions.Configuration.Abstractions (>= 8.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.2)
- Microsoft.Extensions.Logging (>= 8.0.1)
- Syntrony (>= 1.1.0 && < 2.0.0)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on Syntrony.Logging:
| Package | Downloads |
|---|---|
|
Syntrony.Logging.Log4Net
Log4Net sink for Syntrony.Logging — parity with Abp.Castle.Log4Net on top of ILogger native. |
|
|
Syntrony.Web
Exposes Syntrony application services as HTTP endpoints without hand-written controllers: an IApplicationFeatureProvider turns every IApplicationService into a controller and an IApplicationModelConvention derives route, HTTP verb and parameter binding from the method name, replacing ABP's CreateControllersForAppServices. |
|
|
Syntrony.Logging.OpenTelemetry
Backend-agnostic OpenTelemetry telemetry (logs, traces, metrics) for Syntrony.Logging, via OTLP export. |
GitHub repositories
This package is not used by any popular GitHub repositories.