NLog.Targets.MauiLog
8.6.1
Prefix Reserved
dotnet add package NLog.Targets.MauiLog --version 8.6.1
NuGet\Install-Package NLog.Targets.MauiLog -Version 8.6.1
<PackageReference Include="NLog.Targets.MauiLog" Version="8.6.1" />
<PackageVersion Include="NLog.Targets.MauiLog" Version="8.6.1" />
<PackageReference Include="NLog.Targets.MauiLog" />
paket add NLog.Targets.MauiLog --version 8.6.1
#r "nuget: NLog.Targets.MauiLog, 8.6.1"
#:package NLog.Targets.MauiLog@8.6.1
#addin nuget:?package=NLog.Targets.MauiLog&version=8.6.1
#tool nuget:?package=NLog.Targets.MauiLog&version=8.6.1
NLog.Targets.MauiLog
NLog Target for debugging on MAUI / Xamarin Mobile Platforms:
- Apple iOS / MacOS - Unified Logging OSLog (replacement of print and NSLog)
- Android - Android.Util.Log / LogCat
- NetStandard - System.Diagnostics.Debugger.Log
How to setup NLog in MAUI
Install the NLog packages
Install-Package NLog.Targets.MauiLog
Install-Package NLog.Extensions.Logging
or in your csproj (Use ver. 8 for NET8, and ver. 7 for NET7 etc.):
<PackageReference Include="NLog.Targets.MauiLog" Version="8.*" /> <PackageReference Include="NLog.Extensions.Logging" Version="6.*" />
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;
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().RegisterMauiLog() .LoadConfigurationFromAssemblyResource(typeof(App).Assembly);
Alternative setup NLog configuration using fluent-API:
var logger = NLog.LogManager.Setup().RegisterMauiLog() .LoadConfiguration(c => c.ForLogger().FilterMinLevel(NLog.LogLevel.Debug).WriteToMauiLog()) .GetCurrentClassLogger();
Configuration options for MAUI Log Target
- Layout - LogEvent message layout
- Category - LogEvent category layout (optional)
Example NLog.config
-file:
<nlog>
<extensions>
<add assembly="NLog.Targets.MauiLog" />
</extensions>
<targets>
<target name="mauilog" type="MauiLog" />
</targets>
<rules>
<logger name="*" minLevel="Info" writeTo="mauilog" />
</rules>
</nlog>
See also Logging Unhandled Exceptions
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-android34.0 is compatible. net8.0-browser was computed. net8.0-ios was computed. net8.0-ios18.0 is compatible. net8.0-maccatalyst was computed. net8.0-maccatalyst18.0 is compatible. net8.0-macos was computed. net8.0-macos15.0 is compatible. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
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.6.1 | 308 | 6/28/2025 |
8.6.0 | 362 | 6/22/2025 |
8.0.0 | 66,797 | 1/9/2024 |
7.6.1 | 86 | 6/28/2025 |
7.6.0 | 131 | 6/22/2025 |
7.0.0 | 1,263 | 1/9/2024 |
6.6.1 | 83 | 6/28/2025 |
6.6.0 | 130 | 6/22/2025 |
6.0.0 | 401 | 1/9/2024 |
5.2.1 | 10,187 | 10/16/2023 |
5.2.0 | 7,212 | 5/30/2023 |
1.0.4 | 2,389 | 4/11/2023 |
1.0.3 | 217 | 4/10/2023 |
1.0.2 | 16,610 | 11/22/2022 |
1.0.1 | 1,619 | 10/25/2022 |
1.0.0 | 556 | 9/17/2022 |
- Updated to NLog v6.0.1 with AOT-support
See https://github.com/NLog/NLog.Targets.MauiLog for documentation of NLog targets for MAUI