Skip to content

NLog extensions for displaying and updating Windows Performance Counters

License

Notifications You must be signed in to change notification settings

NLog/NLog.PerformanceCounter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NLog.PerformanceCounter

NLog extensions to Display Windows Performance Counters and Update Windows Performance Counters

Version AppVeyor

How to install

  1. Install the package

    Install-Package NLog.PerformanceCounter or in your csproj:

    <PackageReference Include="NLog.PerformanceCounter" Version="5.*" />
  2. Add to your nlog.config:

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

    Alternative register from code using fluent configuration API:

    LogManager.Setup().SetupExtensions(ext => {
       ext.RegisterTarget<NLog.Targets.PerformanceCounterTarget>();
       ext.RegisterLayoutRenderer<NLog.LayoutRenderers.PerformanceCounterLayoutRenderer>();
    });

Example of displaying PerformanceCounter

Example of NLog.config-file that displays Windows Performance Counter value:

<nlog>
    <extensions>
        <add assembly="NLog.PerformanceCounter"/>
    </extensions>
    <targets>
        <target name="console" xsi:type="console" layout="${message}|Memory=${performancecounter:category=Process:counter=Working Set}"  />
    </targets>
    <rules>
        <logger minLevel="Info" writeTo="console" />
    </rules>
</nlog>

Example of updating PerformanceCounter

Example of NLog.config-file that updates Windows Performance Counter value:

<nlog>
    <extensions>
        <add assembly="NLog.PerformanceCounter"/>
    </extensions>
    <targets>
        <target name="perf" xsi:type="PerfCounter" counterName="123" categoryName="xyz" />
    </targets>
    <rules>
        <logger minLevel="Info" writeTo="perf" />
    </rules>
</nlog>

About

NLog extensions for displaying and updating Windows Performance Counters

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages