DiagnosticExplorer.Extensions.Logging
5.0.22
See the version list below for details.
dotnet add package DiagnosticExplorer.Extensions.Logging --version 5.0.22
NuGet\Install-Package DiagnosticExplorer.Extensions.Logging -Version 5.0.22
<PackageReference Include="DiagnosticExplorer.Extensions.Logging" Version="5.0.22" />
<PackageVersion Include="DiagnosticExplorer.Extensions.Logging" Version="5.0.22" />
<PackageReference Include="DiagnosticExplorer.Extensions.Logging" />
paket add DiagnosticExplorer.Extensions.Logging --version 5.0.22
#r "nuget: DiagnosticExplorer.Extensions.Logging, 5.0.22"
#:package DiagnosticExplorer.Extensions.Logging@5.0.22
#addin nuget:?package=DiagnosticExplorer.Extensions.Logging&version=5.0.22
#tool nuget:?package=DiagnosticExplorer.Extensions.Logging&version=5.0.22
DiagnosticExplorer
Add live diagnostic data to a .NET application, then inspect it in a browser.
Dashboard
Inspect registered objects, their properties, and live diagnostic events from one browser view.
Quick Start
This package adds configuration-based Diagnostic Explorer hosting:
<PackageReference Include="DiagnosticExplorer.Hosting" Version="5.0.0" />
This appsettings.json section enables a local viewer and a remote-service
connection. Use either host or both, and tune retention without changing code:
{
"DiagnosticExplorer": {
"Enabled": true,
"Hosts": [
{ "Type": "SelfHost", "Url": "http://127.0.0.1:50001" },
{ "Type": "Remote", "Url": "http://localhost:50000/diagnostics" }
],
"EventRetention": {
"MaxEventsPerSink": 1000,
"MaxAgeMinutes": 30
},
"LogEventRetention": {
"MaxEvents": 5000,
"MaxAgeMinutes": 5
}
}
}
This generic-host setup reads the host configuration, starts the selected hosts, registers diagnostic objects, and configures their presentation:
using DiagnosticExplorer;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
HostApplicationBuilder builder = Host.CreateApplicationBuilder(args);
builder.Services.AddSingleton<WidgetService>();
builder.Services.ConfigureDiagnosticExplorer(
builder.Configuration,
diagnostics =>
{
diagnostics.RegisterObjects(RegisterObjects);
ConfigureClasses(diagnostics);
ConfigureEventRoutes(diagnostics);
}
);
await builder.Build().RunAsync();
RegisterObjects runs when diagnostics are collected. Resolve an application
service, then register the dynamic objects it owns:
private static void RegisterObjects(IDiagRegistrar registrar)
{
WidgetService widgetService = registrar.GetRequiredService<WidgetService>();
registrar.RegisterService<WidgetService>("Application", "Widget service");
foreach (Widget widget in widgetService.Widgets)
registrar.Register(widget, "Widgets", widget.Name);
}
RegisterService<T> resolves T from the application service provider before
registering it. Use it for long-lived services, typically singletons.
Register remains available for objects created at runtime.
Without a type profile, Diagnostic Explorer displays public scalar properties, collection counts, and complex values as drilldown icons. Add a profile to choose exactly what users see and how it behaves:
private static void ConfigureClasses(IDiagConfigurator diagnostics)
{
diagnostics.Configure<Widget>(options =>
{
options.ExcludeAll();
options.Property(widget => widget.Name).Named("Widget name").Category("Details").AllowSet();
options.Property(widget => widget.Connection).Category("Connection").Expand();
options.Property(widget => widget.Components)
.ListItems(list => list.Name(component => component.Name).Value(component => component.Status))
.WithMaxItems(50);
options.Property(widget => widget.Configuration).AsJson(100).WithJsonHover().WithDrillDown();
});
diagnostics.ConfigureDrillDown<WidgetConfiguration>(options =>
{
options.ExcludeAll();
options.Property(instance => instance.Status);
options.Property(instance => instance.Owner).AsDrillDown();
});
}
Use IncludeAll() to start from every public property, or ExcludeAll() to
start from none. Property adds display metadata and can render nested object
bags with Expand(). For properties declared as an array, ICollection<T>,
IList<T>, IReadOnlyCollection<T>, IReadOnlyList<T>, or ISet<T>, use
Property(...) to display a count by default, or ListItems(...) and
ConcatItems(...) to select another rendering. Use Property(name, value) for
named or computed properties. AllowSet() exposes an editable property.
AsJson() with WithJsonHover() fetches JSON only on hover.
AsDrillDown() makes a complex value, collection item, or custom property
interactive. AsDrillDownIcon() provides a compact icon-only entry point. A
dedicated drilldown profile controls the overlay; otherwise the normal type
profile is reused:
diagnostics.Configure<Widget>(options =>
{
options.Property(widget => widget.Configuration).WithDrillDown(maxItems: 50);
options.Property(widget => widget.Components)
.ListItems(list => list.Name(component => component.Name))
.AsDrillDownIcon();
});
diagnostics.ConfigureDrillDown<WidgetConfiguration>(options =>
{
options.ExcludeAll();
options.Property(instance => instance.Status);
options.Property(instance => instance.Owner).WithDrillDown();
});
Private fields and anonymous objects
Use a named delegate property to expose computed or private state. Write the configuration inside the declaring type when it needs private-field access:
private static void ConfigureDiagnostics(IDiagConfigurator diagnostics)
{
diagnostics.Configure<Widget>(options =>
{
options.Property("Retry count", widget => widget._retryCount).Category("Internal");
options.Property("Last error", widget => widget._lastError?.Message).Category("Internal");
});
}
For DateTime and DateTimeOffset values, date display options are available
directly from Property:
options.Property(widget => widget._lastUpdated).ShowElapsed();
options.Property("Last updated", widget => widget._lastUpdated).ShowDate(false).ShowElapsed();
For RateCounter values, configure rate and total displays the same way:
options.Property(widget => widget._requests).ShowRate(false).ShowTotal();
options.Property("Background requests", widget => widget._backgroundRequests).ShowTotal();
Return an anonymous object for a small, read-only diagnostic snapshot. Its generated public properties render in the drilldown view:
options.Property(
"Connection snapshot",
widget => new
{
widget.Connection.Endpoint,
widget.Connection.IsConnected,
}
)
.AsDrillDownIcon("View connection");
See fluent diagnostic configuration for property, custom-property, category, limit, and nested drilldown behavior.
This helper routes events from named loggers to separate event sinks. Each integration below uses these same routes:
private static void ConfigureEventRoutes(IDiagConfigurator diagnostics)
{
diagnostics.ConfigureEventRouting(routes =>
routes
.UseMatchMode(EventSinkRouteMatchMode.AllMatches)
.Route("Widgets", route => route.AtLeast(LogLevel.Information).To("Widgets", "Widget Events"))
.Route("Gadgets", route => route.AtLeast(LogLevel.Warning).To("Gadgets", "Gadget Warnings"))
.Route("*", route => route.AtLeast(LogLevel.Error).To("System", "Errors")));
}
For an application without a generic host, create the configuration, register objects directly, and start the configured hosts yourself:
using DiagnosticExplorer;
DiagnosticConfiguration diagnostics = DiagnosticManager.Configure(config =>
{
config.ConfigureHosting(applicationConfiguration);
ConfigureClasses(config);
ConfigureEventRoutes(config);
});
DiagnosticManager.Register(widget, "Widget 42", "Widgets");
await DiagnosticHostingService.StartAsync(diagnostics);
try
{
RunApplication();
}
finally
{
await DiagnosticHostingService.Stop();
}
Run the application and open the configured SelfHost URL in a browser. For a
Remote host, run DiagnosticService, open its configured URL, and select
your registered application.
Download
Download the latest DiagnosticService Windows Service installer.
Microsoft.Extensions.Logging
This optional package forwards Microsoft.Extensions.Logging events to
Diagnostic Explorer:
<PackageReference Include="DiagnosticExplorer.Extensions.Logging" Version="5.0.0" />
This registers the logging provider after ConfigureDiagnosticExplorer:
using DiagnosticExplorer;
using DiagnosticExplorer.Extensions.Logging;
using Microsoft.Extensions.Logging;
services.AddLogging(logging => logging.AddDiagnosticExplorer());
The provider sends matching Microsoft.Extensions.Logging events to Diagnostic
Explorer, including structured properties:
logger.LogInformation("Processed {WidgetCount} widgets", widgetCount);
NLog
This package adds a Diagnostic Explorer target to NLog:
<PackageReference Include="DiagnosticExplorer.NLog" Version="5.0.0" />
This configuration sends NLog events through the routes configured above:
using DiagnosticExplorer.NLog;
using NLog;
using NLog.Config;
LoggingConfiguration logging = new();
logging.AddDiagnosticExplorer();
LogManager.Configuration = logging;
NLog templates retain their event properties:
logger.Info("Processed {WidgetCount} widgets", widgetCount);
Serilog
This package adds a Diagnostic Explorer sink to Serilog:
<PackageReference Include="DiagnosticExplorer.Serilog" Version="5.0.0" />
This configuration sends Serilog events through the routes configured above:
using DiagnosticExplorer.Serilog;
using Serilog;
using ILogger logger = new LoggerConfiguration()
.MinimumLevel.Verbose()
.WriteTo.DiagnosticExplorer()
.CreateLogger();
Serilog properties are forwarded with the event:
logger.Information("Processed {WidgetCount} widgets", widgetCount);
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- DiagnosticExplorer (>= 5.0.22)
- Microsoft.Extensions.Configuration.Binder (>= 8.0.0)
- Microsoft.Extensions.Logging (>= 8.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 5.3.2 | 115 | 9/27/2026 |
| 5.3.1 | 110 | 9/27/2026 |
| 5.3.0 | 116 | 9/2/2026 |
| 5.2.0 | 124 | 9/2/2026 |
| 5.1.0 | 112 | 9/1/2026 |
| 5.0.31 | 121 | 8/31/2026 |
| 5.0.30 | 112 | 8/30/2026 |
| 5.0.29 | 121 | 8/30/2026 |
| 5.0.28 | 111 | 8/29/2026 |
| 5.0.27 | 118 | 8/29/2026 |
| 5.0.26 | 121 | 8/28/2026 |
| 5.0.25 | 116 | 8/28/2026 |
| 5.0.24 | 120 | 8/28/2026 |
| 5.0.23 | 116 | 8/28/2026 |
| 5.0.22 | 114 | 8/28/2026 |
| 5.0.21 | 116 | 8/28/2026 |
| 5.0.20 | 114 | 8/28/2026 |
| 5.0.19 | 116 | 8/28/2026 |
| 5.0.18 | 118 | 8/27/2026 |
| 5.0.17 | 115 | 8/27/2026 |