NLog.Etw 5.2.4

Prefix Reserved
dotnet add package NLog.Etw --version 5.2.4                
NuGet\Install-Package NLog.Etw -Version 5.2.4                
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="NLog.Etw" Version="5.2.4" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add NLog.Etw --version 5.2.4                
#r "nuget: NLog.Etw, 5.2.4"                
#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.
// Install NLog.Etw as a Cake Addin
#addin nuget:?package=NLog.Etw&version=5.2.4

// Install NLog.Etw as a Cake Tool
#tool nuget:?package=NLog.Etw&version=5.2.4                

NLog.Etw

Version AppVeyor codecov.io

NLog Target for writing logevents to Event Tracing for Windows (ETW).

Install nuget-package to your project:

dotnet add package NLog.Etw

Example NLog.config file

Example of NLog.config-file that writes to ETW:

<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"">

    <extensions>
        <add assembly="NLog.Etw" />
    </extensions>

    <targets async="true">
        <target type="EtwEventSource"
                name="eetw"
                providerName="MyEventSourceName"
                taskName="${level}"
                layout="${message}"
              />
    </targets>
    
    <rules>
      <logger name="*" minlevel="Trace" writeTo="eetw" />
    </rules>
</nlog>

Example Custome EventSource

Example of providing own custom EventSource for writing events:

[EventSource(Name = "MyEventSourceName")]
public class MyEventSource : EventSource, NLog.Etw.INLogEventSource
{
    /// <inheritdoc/>
    [NonEvent]
    public void Write(EventLevel eventLevel, string layoutMessage, LogEventInfo logEvent)
    {
        // TODO Call own custom logging-method
    }

    /// <inheritdoc/>
    EventSource EventSource { get { return this; } }

    internal readonly static MyEventSource Log = new MyEventSource();
}

var config = new NLog.Config.LoggingConfiguration();
config.AddRuleForAllLevels(new NLog.Etw.NLogEtwExtendedTarget(MyEventSource.Log) { Name = "eetw" });
NLog.LogManager.Configuration = config;

Example with EtwEventCounter Target

Example of NLog.config-file that writes to ETW-EventCounter:

<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

    <extensions>
        <add assembly="NLog.Etw" />
    </extensions>

    <targets async="true">
        <target type="EtwEventCounter"
                name="etwCounter"
                providerName="MyEventSourceName"
                providerName="MyEventCounterName"
                metricValue="1"
              />
    </targets>
    
    <rules>
      <logger name="*" minlevel="Trace" writeTo="etwCounter" />
    </rules>
</nlog>
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. 
.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 net45 is compatible.  net451 was computed.  net452 was computed.  net46 is compatible.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 is compatible.  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

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.2.4 10,028 5/9/2024
5.2.2 11,726 10/15/2023
5.0.0 106,460 8/17/2022
4.3.0 100,248 8/31/2019
4.2.0 1,997 1/25/2019
4.1.0 23,602 10/25/2016
4.0.1 1,635 12/18/2015
4.0.0 1,449 12/17/2015
1.1.0 1,263 8/25/2015

- Added new EtwEventCounter-Target for writing to ETW EventCounter using WriteMetric

See https://github.com/NLog/NLog.Etw for documentation of NLog target for ETW