Plinth.Logging.NLog.AppInsights
1.5.10-b186.aca976b4
Prefix Reserved
This is a prerelease version of Plinth.Logging.NLog.AppInsights.
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package Plinth.Logging.NLog.AppInsights --version 1.5.10-b186.aca976b4
NuGet\Install-Package Plinth.Logging.NLog.AppInsights -Version 1.5.10-b186.aca976b4
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="Plinth.Logging.NLog.AppInsights" Version="1.5.10-b186.aca976b4" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Plinth.Logging.NLog.AppInsights --version 1.5.10-b186.aca976b4
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Plinth.Logging.NLog.AppInsights, 1.5.10-b186.aca976b4"
#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 Plinth.Logging.NLog.AppInsights as a Cake Addin #addin nuget:?package=Plinth.Logging.NLog.AppInsights&version=1.5.10-b186.aca976b4&prerelease // Install Plinth.Logging.NLog.AppInsights as a Cake Tool #tool nuget:?package=Plinth.Logging.NLog.AppInsights&version=1.5.10-b186.aca976b4&prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
README
Plinth.Logging.NLog.AppInsights
Integration allowing Plinth and NLog to record telemetry and logs to Azure Application Insights
1. Add this to your NLog.config under the <nlog>
tag
<extensions>
<add assembly="Plinth.Logging.NLog.AppInsights" prefix="plinthAI" />
</extensions>
2. Then create the target
<targets>
<target xsi:type="plinthAI.AppInsightsTarget" name="aiTarget">
<connectionString>{from-Azure-Portal}</connectionString>
<cloudRoleName>testRole1</cloudRoleName>
<cloudRoleInstance>serverA</cloudRoleInstance>
<maxLength>25000</maxLength>
</target>
</targets>
- 👉 Do not wrap this in an async wrapper. It will break the context and metadata.
cloudRoleName
andcloudRoleInstance
are optional, and will have reasonable defaults if not specified- Cloud Role Name is typically the application name
- Cloud Role Instance is typically the machine name
- The
maxLength
field is optional, and defaults to 25000 characters - 👉 Using a connection string is preferred.
<instrumentationKey>
is supported but deprecated and will stop working in March 2025
3. Reference the target in a logger rule
<rules>
<logger name="*" minlevel="Debug" writeTo="aiTarget" />
</rules>
4. Initialize telemetry in Startup
services.AddPlinthAppInsightsTelemetry(cfg =>
{
cfg.CloudRoleName = "MyApp";
cfg.DisabledPrefixes.Add("/health");
});
👉 The lambda is optional and only necessary if setting hardcoded configuration
Configurations Options are
ConnectionString
: If not setting via environment variable or NLog.configDisabledPrefixes
: A blacklist of url prefixes to disable Request Telemetry. Example:"/favicon.ico"
EnabledPrefixes
: A whitelist of url prefixes to enable Request Telemetry. This is null by default. If a list of prefixes is specified, only requests which match will have request telemetry. If there is a conflict between this andDisabledPrefixes
, the preference is to disable telemetry.CaptureSqlCommandText
: Set to true to have SQL Dependency Telemetry capture the SQL command text sent to the database. Defaults to false.CloudRoleName
: See next sectionCloudRoleInstance
: See next section
5. Application Insights Configuration Settings
Values are applied in this order of precedence
Connection String (get this from the Azure Portal)
- Hardcoded parameter passed in Startup.cs (does not apply to NLog logs)
- NLog.config
<connectionString>
- Environment variable:
APPLICATIONINSIGHTS_CONNECTION_STRING
- (Obsolete): NLog.config
<instrumentationKey>
- (Obsolete): Environment variable
APPINSIGHTS_INSTRUMENTATIONKEY
Cloud Role Name
- Hardcoded parameter passed in Startup.cs (does not apply to NLog logs)
- NLog.config
<cloudRoleName>
- Environment variable:
APPLICATIONINSIGHTS_CLOUD_ROLENAME
Cloud Role Instance
- Hardcoded parameter passed in Startup.cs (does not apply to NLog logs)
- NLog.config
<cloudRoleInstance>
- Environment variable:
APPLICATIONINSIGHTS_CLOUD_ROLEINSTANCE
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. 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 is compatible. 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 is compatible. 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net6.0
- Microsoft.ApplicationInsights (>= 2.21.0)
- Microsoft.ApplicationInsights.AspNetCore (>= 2.21.0)
- Microsoft.SourceLink.Bitbucket.Git (>= 1.1.1)
- Plinth.Common (>= 1.5.10-b186.aca976b4)
- Plinth.Logging.NLog (>= 1.5.10-b186.aca976b4)
-
net7.0
- Microsoft.ApplicationInsights (>= 2.21.0)
- Microsoft.ApplicationInsights.AspNetCore (>= 2.21.0)
- Microsoft.SourceLink.Bitbucket.Git (>= 1.1.1)
- Plinth.Common (>= 1.5.10-b186.aca976b4)
- Plinth.Logging.NLog (>= 1.5.10-b186.aca976b4)
-
net8.0
- Microsoft.ApplicationInsights (>= 2.21.0)
- Microsoft.ApplicationInsights.AspNetCore (>= 2.21.0)
- Microsoft.SourceLink.Bitbucket.Git (>= 1.1.1)
- Plinth.Common (>= 1.5.10-b186.aca976b4)
- Plinth.Logging.NLog (>= 1.5.10-b186.aca976b4)
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 |
---|---|---|
1.7.0 | 72 | 11/12/2024 |
1.6.6 | 80 | 11/8/2024 |
1.6.5 | 219 | 8/31/2024 |
1.6.4 | 65 | 8/2/2024 |
1.6.3 | 153 | 5/15/2024 |
1.6.2 | 182 | 2/16/2024 |
1.6.1 | 2,454 | 1/5/2024 |
1.6.0 | 314 | 11/30/2023 |
1.5.10-b186.aca976b4 | 73 | 11/30/2023 |
1.5.9 | 135 | 11/29/2023 |
1.5.9-b174.64153841 | 82 | 11/23/2023 |
1.5.9-b172.dfc6e7bd | 70 | 11/17/2023 |
1.5.9-b171.4e2b92e2 | 81 | 11/4/2023 |
1.5.8 | 161 | 10/23/2023 |
1.5.7 | 3,888 | 7/31/2023 |
1.5.6 | 3,388 | 7/13/2023 |
1.5.5 | 197 | 6/29/2023 |
1.5.4 | 584 | 3/7/2023 |
1.5.3 | 264 | 3/3/2023 |
1.5.2 | 512 | 1/11/2023 |
1.5.2-b92.7c961f5f | 122 | 1/11/2023 |
1.5.0 | 377 | 11/9/2022 |
1.5.0-b88.7a7c20cd | 108 | 11/9/2022 |
1.4.7 | 3,100 | 10/20/2022 |
1.4.6 | 575 | 10/17/2022 |
1.4.5 | 706 | 10/1/2022 |
1.4.4 | 481 | 8/16/2022 |
1.4.3 | 498 | 8/2/2022 |
1.4.2 | 668 | 7/19/2022 |
1.4.2-b80.7fdbfd04 | 134 | 7/19/2022 |
1.4.2-b74.acaf86f5 | 117 | 6/15/2022 |
1.4.1 | 487 | 6/13/2022 |
1.4.0 | 499 | 6/6/2022 |
1.3.8 | 1,156 | 4/12/2022 |
1.3.7 | 552 | 3/21/2022 |
1.3.6 | 550 | 3/17/2022 |
1.3.6-b67.ca5053f3 | 132 | 3/16/2022 |
1.3.6-b66.4a9683e6 | 127 | 3/16/2022 |
1.3.5 | 590 | 2/23/2022 |
1.3.4 | 895 | 1/20/2022 |
1.3.3 | 332 | 12/29/2021 |
1.3.2 | 503 | 12/11/2021 |
1.3.1 | 365 | 11/12/2021 |
1.3.0 | 384 | 11/8/2021 |
1.2.3 | 1,571 | 9/22/2021 |
1.2.2 | 399 | 8/20/2021 |
1.2.1 | 392 | 8/5/2021 |
1.2.0 | 450 | 8/1/2021 |
1.2.0-b37.a54030b9 | 163 | 6/24/2021 |
1.1.6 | 3,080 | 3/22/2021 |
1.1.5 | 592 | 3/9/2021 |
1.1.4 | 484 | 2/27/2021 |
1.1.3 | 485 | 2/17/2021 |
1.1.2 | 509 | 2/12/2021 |
1.1.1 | 514 | 2/1/2021 |
1.1.0 | 532 | 12/16/2020 |
1.1.0-b27.b66c309b | 284 | 11/15/2020 |
1.0.12 | 700 | 10/18/2020 |
1.0.11 | 600 | 10/6/2020 |
net8.0 support