Elastic.Apm.NLog 8.11.0

The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org. Prefix Reserved
dotnet add package Elastic.Apm.NLog --version 8.11.0
NuGet\Install-Package Elastic.Apm.NLog -Version 8.11.0
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.11.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Elastic.Apm.NLog --version 8.11.0
#r "nuget: Elastic.Apm.NLog, 8.11.0"
#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.11.0

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

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 is compatible.  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

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.11.0 488 4/10/2024
8.6.1 56,716 8/3/2023
8.6.0 20,132 5/9/2023
8.4.0-alpha4 123 3/28/2023
8.4.0-alpha3 100 3/15/2023
8.4.0-alpha2 100 3/1/2023
8.4.0-alpha1 108 2/20/2023
1.6.0-alpha1 5,745 6/2/2021
1.5.3 772,249 6/1/2021
1.5.1 105,802 6/3/2020
1.5.0 3,841 3/30/2020
1.4.4 519 3/25/2020
1.4.3 956 3/16/2020
1.4.2 631 3/6/2020
1.4.1 607 2/26/2020
1.4.0 6,856 1/29/2020
1.4.0-beta1 573 1/7/2020