NLog.Targets.MauiLog 6.6.2

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package NLog.Targets.MauiLog --version 6.6.2
                    
NuGet\Install-Package NLog.Targets.MauiLog -Version 6.6.2
                    
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="NLog.Targets.MauiLog" Version="6.6.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="NLog.Targets.MauiLog" Version="6.6.2" />
                    
Directory.Packages.props
<PackageReference Include="NLog.Targets.MauiLog" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add NLog.Targets.MauiLog --version 6.6.2
                    
#r "nuget: NLog.Targets.MauiLog, 6.6.2"
                    
#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.
#:package NLog.Targets.MauiLog@6.6.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=NLog.Targets.MauiLog&version=6.6.2
                    
Install as a Cake Addin
#tool nuget:?package=NLog.Targets.MauiLog&version=6.6.2
                    
Install as a Cake Tool

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

Version AppVeyor

How to setup NLog in MAUI

  1. 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.*" />
    
  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().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 Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-android33.0 is compatible.  net6.0-ios was computed.  net6.0-ios16.1 is compatible.  net6.0-maccatalyst was computed.  net6.0-maccatalyst16.1 is compatible.  net6.0-macos was computed.  net6.0-macos13.0 is compatible.  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.  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. 
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 (1)

Showing the top 1 popular GitHub repositories that depend on NLog.Targets.MauiLog:

Repository Stars
ciribob/DCS-SimpleRadioStandalone
An open source Stand alone Radio for DCS integrating with all clickable cockpits and FC3 Aircraft
Version Downloads Last Updated
8.6.2 1,935 7/20/2025
8.6.1 841 6/28/2025
8.6.0 520 6/22/2025
8.0.0 72,446 1/9/2024
7.6.2 316 7/20/2025
7.6.1 98 6/28/2025
7.6.0 143 6/22/2025
7.0.0 1,279 1/9/2024
6.6.2 315 7/20/2025
6.6.1 94 6/28/2025
6.6.0 144 6/22/2025
6.0.0 416 1/9/2024
5.2.1 10,226 10/16/2023
5.2.0 7,270 5/30/2023
1.0.4 2,415 4/11/2023
1.0.3 239 4/10/2023
1.0.2 16,982 11/22/2022
1.0.1 1,676 10/25/2022
1.0.0 606 9/17/2022

- Updated to NLog v6.0.2 with AOT-support

See https://github.com/NLog/NLog.Targets.MauiLog for documentation of NLog targets for MAUI