DiagnosticExplorer.Log4Net 5.0.23

There is a newer version of this package available.
See the version list below for details.
dotnet add package DiagnosticExplorer.Log4Net --version 5.0.23
                    
NuGet\Install-Package DiagnosticExplorer.Log4Net -Version 5.0.23
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DiagnosticExplorer.Log4Net" Version="5.0.23" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DiagnosticExplorer.Log4Net" Version="5.0.23" />
                    
Directory.Packages.props
<PackageReference Include="DiagnosticExplorer.Log4Net" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add DiagnosticExplorer.Log4Net --version 5.0.23
                    
#r "nuget: DiagnosticExplorer.Log4Net, 5.0.23"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package DiagnosticExplorer.Log4Net@5.0.23
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=DiagnosticExplorer.Log4Net&version=5.0.23
                    
Install as a Cake Addin
#tool nuget:?package=DiagnosticExplorer.Log4Net&version=5.0.23
                    
Install as a Cake Tool

DiagnosticExplorer

Add live diagnostic data to a .NET application, then inspect it in a browser.

Dashboard

Diagnostic Explorer dashboard showing registered gadgets and live gadget events

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>, or the common concrete List<T>, HashSet<T>, ObservableCollection<T>, and BindingList<T> types, use Property(...) to display a count by default, or ListItems(...) and ConcatItems(...) to select another rendering. Dictionary<TKey, TValue>, IDictionary<TKey, TValue>, and IReadOnlyDictionary<TKey, TValue> are also supported and present their key/value pairs. 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on DiagnosticExplorer.Log4Net:

Package Downloads
DiagnosticExplorer.Hosting

Diagnostic Explorer libraries for runtime object inspection, event sinks, logging integration, and diagnostics hosting.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
5.3.2 452 9/27/2026
5.3.1 126 9/27/2026
5.3.0 427 9/2/2026
5.2.0 142 9/2/2026
5.1.0 153 9/1/2026
5.0.31 137 8/31/2026
5.0.30 127 8/30/2026
5.0.29 138 8/30/2026
5.0.28 127 8/29/2026
5.0.27 126 8/29/2026
5.0.26 140 8/28/2026
5.0.25 130 8/28/2026
5.0.24 135 8/28/2026
5.0.23 132 8/28/2026
5.0.22 140 8/28/2026
5.0.21 129 8/28/2026
5.0.20 142 8/28/2026
5.0.19 131 8/28/2026
5.0.18 136 8/27/2026
5.0.17 130 8/27/2026
Loading failed