GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - NLog/NLog.AzureAppCenter: NLog target for Microsoft Visual Studio App Center with Azure

BranchesTags
Open more actions menu

Latest commit

 

History

61 Commits
61 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
src
src
 
 
tests/NLog.Targets.AppCenter.Tests
tests/NLog.Targets.AppCenter.Tests
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
NLog.AppCenter.sln
NLog.AppCenter.sln
 
 
README.md
README.md
 
 
codecov.yml
codecov.yml
 
 

Repository files navigation

NLog.Targets.AppCenter

NLog Target for Microsoft Visual Studio App Center with Azure

Version CI

⚠️ Microsoft AppCenter will be retired - https://learn.microsoft.com/appcenter/retirement

How to setup NLog in MAUI

  1. Install the NLog packages

    • Install-Package NLog.Targets.AppCenter
    • Install-Package NLog.Extensions.Logging

    or in your csproj:

    <PackageReference Include="NLog.Targets.AppCenter" Version="6.*" />
    <PackageReference Include="NLog.Extensions.Logging" Version="6.*" />
  2. Add NLog to the MauiApp

    Update MauiProgram.cs to include NLog as Logging Provider:

    var builder = MauiApp.CreateBuilder();
    
    // Add NLog for Logging
    builder.Logging.ClearProviders();
    builder.Logging.AddNLog();

    If getting compiler errors with unknown methods, then update using-section:

    using Microsoft.Extensions.Logging;
    using NLog;
    using NLog.Extensions.Logging;
  3. Load NLog configuration for logging

    Add the NLog.config-file into the Application-project as assembly-resource (Build Action = embedded resource), and load like this:

    NLog.LogManager.Setup().RegisterAppCenter()
        .LoadConfigurationFromAssemblyResource(typeof(App).Assembly);

    Alternative setup NLog configuration using fluent-API:

    var logger = NLog.LogManager.Setup().RegisterAppCenter()
                     .LoadConfiguration(c => c.ForLogger().FilterMinLevel(NLog.LogLevel.Debug).WriteToAppCenter())
                     .GetCurrentClassLogger();

Configuration options for AppCenter NLog Target

  • AppSecret - Appsecret for starting AppCenter if needed (optional)
  • UserId - Application UserId to register in AppCenter (optional)
  • LogUrl - Base URL (scheme + authority + port only) to the AppCenter-backend (optional)
  • CountryCode - Two-letter ISO country code to send to the AppCenter-backend (optional)
  • DataResidencyRegion - Country Code or other identifier of data residency region (optional)
  • ReportExceptionAsCrash - Report all exceptions as crashes to AppCenter (default=false)
  • IncludeEventProperties - Include LogEvent properties in AppCenter properties (default=true)
  • IncludeScopeProperties - Include MappedDiagnosticsLogicalContext (MLDC) that can be provided with MEL BeginScope (default=false)

Example NLog.config file

<nlog throwConfigExceptions="true">
<extensions>
    <add assembly="NLog.Targets.AppCenter"/>
</extensions>
<targets>
    <target name="appcenter" type="appcenter" layout="${message}" reportExceptionAsCrash="true">
	<contextproperty name="logger" layout="${logger}" />
	<contextproperty name="loglevel" layout="${level}" />
	<contextproperty name="threadid" layout="${threadid}" />
    </target>
</targets>
<rules>
    <logger name="*" minLevel="Info" writeTo="appcenter" />
</rules>
</nlog>

About

NLog target for Microsoft Visual Studio App Center with Azure

Topics

appcenterazurecsharpdotnetmobile-centernet-corenetstandardnlognlog-target

Resources

Readme
BSD-3-Clause license
Activity
Custom properties

Stars

9 stars

Watchers

3 watching

Forks

4 forks
Report repository

Releases

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.