Elastic.Apm.NLog 8.12.2

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

// Install Elastic.Apm.NLog as a Cake Tool
#tool nuget:?package=Elastic.Apm.NLog&version=8.12.2                

Elastic APM NLog Layout Renderer

Allows you to add the following place holders in your NLog templates:

  • ElasticApmTraceId
  • ElasticApmTransactionId
  • ElasticApmSpanId
  • ElasticApmServiceName
  • ElasticApmServiceNodeName
  • ElasticApmServiceVersion

Which will be replaced with the appropriate Elastic APM variables if available

Packages

The .NET assemblies are published to NuGet under the package name Elastic.Apm.NLog

How to use from API

// Logged message will be in format of `trace-id|transation-id|span-id|InTransaction`
// or `|||InTransaction` if the place holders are not available
var consoleTarget = new ConsoleTarget("console");
consoleTarget.Layout = 
    "${ElasticApmServiceName}|${ElasticApmTraceId}|${ElasticApmTransactionId}|${ElasticApmSpanId}|${message}";
config.AddRule(LogLevel.Debug, LogLevel.Fatal, consoleTarget);
LogManager.Configuration = config;
var logger = LogManager.GetCurrentClassLogger();

How to use from NLog.config

<nlog>
  <extensions>
    <add assembly="Elastic.Apm.NLog"/>
  </extensions>
  <targets>
    <target name="console" 
        type="console" 
        layout="${ElasticApmTraceId}|${ElasticApmTransactionId}|${ElasticApmSpanId}|${message}" />
  </targets>
  <rules>
    <logger name="*" minLevel="Debug" writeTo="Console" />
  </rules>
</nlog>

Prerequisite

The prerequisite for this to work is a configured Elastic APM Agent. If the agent is not configured the APM place holders will be empty.

This software is Copyright (c) 2014-2020 by Elasticsearch BV.

This is free software, licensed under: The Apache License Version 2.0.

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 net461 was computed.  net462 is compatible.  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

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
8.12.2 4,125 10/22/2024
8.12.1 4,929 10/3/2024
8.12.0 1,121 9/26/2024
8.11.1 26,116 6/10/2024
8.11.0 14,752 4/10/2024
8.6.1 121,734 8/3/2023
8.6.0 32,251 5/9/2023
8.4.0-alpha4 138 3/28/2023
8.4.0-alpha3 121 3/15/2023
8.4.0-alpha2 120 3/1/2023
8.4.0-alpha1 130 2/20/2023
1.6.0-alpha1 6,326 6/2/2021
1.5.3 898,632 6/1/2021
1.5.1 119,714 6/3/2020
1.5.0 5,989 3/30/2020
1.4.4 542 3/25/2020
1.4.3 979 3/16/2020
1.4.2 654 3/6/2020
1.4.1 619 2/26/2020
1.4.0 7,127 1/29/2020
1.4.0-beta1 583 1/7/2020