{"id":23451283,"url":"https://github.com/nlog/nlog.azureappcenter","last_synced_at":"2025-04-13T20:34:39.655Z","repository":{"id":45887001,"uuid":"202887885","full_name":"NLog/NLog.AzureAppCenter","owner":"NLog","description":"NLog target for Microsoft Visual Studio App Center with Azure","archived":false,"fork":false,"pushed_at":"2024-06-05T19:27:32.000Z","size":57,"stargazers_count":10,"open_issues_count":2,"forks_count":4,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-12-05T23:45:54.418Z","etag":null,"topics":["appcenter","azure","csharp","dotnet","mobile-center","net-core","netstandard","nlog","nlog-target"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NLog.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-08-17T14:01:15.000Z","updated_at":"2024-06-05T19:27:36.000Z","dependencies_parsed_at":"2023-12-31T14:22:56.578Z","dependency_job_id":"6617a1ef-e19e-45b2-8ea2-e22dd84cd272","html_url":"https://github.com/NLog/NLog.AzureAppCenter","commit_stats":null,"previous_names":["nlog/nlog.appcenter"],"tags_count":31,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NLog%2FNLog.AzureAppCenter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NLog%2FNLog.AzureAppCenter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NLog%2FNLog.AzureAppCenter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NLog%2FNLog.AzureAppCenter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NLog","download_url":"https://codeload.github.com/NLog/NLog.AzureAppCenter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":231033416,"owners_count":18317974,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["appcenter","azure","csharp","dotnet","mobile-center","net-core","netstandard","nlog","nlog-target"],"created_at":"2024-12-24T00:25:34.584Z","updated_at":"2024-12-24T00:25:35.512Z","avatar_url":"https://github.com/NLog.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"﻿# NLog.Targets.AppCenter\r\nNLog Target for [Microsoft Visual Studio App Center with Azure](https://azure.microsoft.com/services/app-center/)\r\n\r\n[![Version](https://badge.fury.io/nu/NLog.Targets.AppCenter.svg)](https://www.nuget.org/packages/NLog.Targets.AppCenter)\r\n[![AppVeyor](https://img.shields.io/appveyor/ci/nlog/nlog-azureappcenter/master.svg)](https://ci.appveyor.com/project/nlog/nlog-azureappcenter/branch/master)\r\n\r\n⚠️ Microsoft AppCenter will be retired - https://learn.microsoft.com/appcenter/retirement\r\n\r\n## How to setup NLog in MAUI\r\n\r\n1) **Install the NLog packages**\r\n\r\n   - `Install-Package NLog.Targets.AppCenter` \r\n   - `Install-Package NLog.Extensions.Logging` \r\n    \r\n   or in your csproj:\r\n\r\n    ```xml\r\n    \u003cPackageReference Include=\"NLog.Targets.AppCenter\" Version=\"5.*\" /\u003e\r\n    \u003cPackageReference Include=\"NLog.Extensions.Logging\" Version=\"5.*\" /\u003e\r\n    ```\r\n\r\n2) **Add NLog to the MauiApp**\r\n\r\n   Update `MauiProgram.cs` to include NLog as Logging Provider: \r\n   ```csharp\r\n   var builder = MauiApp.CreateBuilder();\r\n\r\n   // Add NLog for Logging\r\n   builder.Logging.ClearProviders();\r\n   builder.Logging.AddNLog();\r\n   ```\r\n\r\n   If getting compiler errors with unknown methods, then update `using`-section:\r\n   ```csharp\r\n   using Microsoft.Extensions.Logging;\r\n   using NLog;\r\n   using NLog.Extensions.Logging;\r\n   ```\r\n\r\n3) **Load NLog configuration for logging**\r\n\r\n   Add the `NLog.config`-file into the Application-project as assembly-resource (`Build Action` = `embedded resource`), and load like this:\r\n   ```csharp\r\n   NLog.LogManager.Setup().RegisterAppCenter()\r\n       .LoadConfigurationFromAssemblyResource(typeof(App).Assembly);\r\n   ```\r\n   Alternative setup NLog configuration using [fluent-API](https://github.com/NLog/NLog/wiki/Fluent-Configuration-API):\r\n   ```csharp\r\n   var logger = NLog.LogManager.Setup().RegisterAppCenter()\r\n                    .LoadConfiguration(c =\u003e c.ForLogger().FilterMinLevel(NLog.LogLevel.Debug).WriteToAppCenter())\r\n                    .GetCurrentClassLogger();\r\n   ```\r\n\r\n## Configuration options for AppCenter NLog Target\r\n\r\n- **AppSecret** - Appsecret for starting AppCenter if needed (optional)\r\n- **UserId** - Application UserId to register in AppCenter (optional)\r\n- **LogUrl** - Base URL (scheme + authority + port only) to the AppCenter-backend (optional)\r\n- **CountryCode** - Two-letter ISO country code to send to the AppCenter-backend (optional)\r\n- **DataResidencyRegion** - Country Code or other identifier of data residency region (optional)\r\n- **ReportExceptionAsCrash** - Report all exceptions as crashes to AppCenter (default=false)\r\n- **IncludeEventProperties** - Include LogEvent properties in AppCenter properties (default=true)\r\n- **IncludeScopeProperties** - Include MappedDiagnosticsLogicalContext (MLDC) that can be provided with MEL BeginScope (default=false)\r\n\r\n## Example NLog.config file\r\n\r\n```xml\r\n\u003cnlog throwConfigExceptions=\"true\"\u003e\r\n\u003cextensions\u003e\r\n    \u003cadd assembly=\"NLog.Targets.AppCenter\"/\u003e\r\n\u003c/extensions\u003e\r\n\u003ctargets\u003e\r\n    \u003ctarget name=\"appcenter\" type=\"appcenter\" layout=\"${message}\" reportExceptionAsCrash=\"true\"\u003e\r\n\t\u003ccontextproperty name=\"logger\" layout=\"${logger}\" /\u003e\r\n\t\u003ccontextproperty name=\"loglevel\" layout=\"${level}\" /\u003e\r\n\t\u003ccontextproperty name=\"threadid\" layout=\"${threadid}\" /\u003e\r\n    \u003c/target\u003e\r\n\u003c/targets\u003e\r\n\u003crules\u003e\r\n    \u003clogger name=\"*\" minLevel=\"Info\" writeTo=\"appcenter\" /\u003e\r\n\u003c/rules\u003e\r\n\u003c/nlog\u003e\r\n```\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnlog%2Fnlog.azureappcenter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnlog%2Fnlog.azureappcenter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnlog%2Fnlog.azureappcenter/lists"}