Skip to content

Logging

Elvin Thudugala edited this page Mar 22, 2026 · 2 revisions

You can configure internal logging using LocalNotificationLogger from the Plugin.LocalNotification.Core namespace.

LocalNotificationLogger has two properties:

  • Logger — set an ILogger instance to receive internal log messages
  • LogLevel — set the minimum log level (default: LogLevel.Trace)

For example, you can use DebugLoggerProvider from Microsoft.Extensions.Logging.Debug.

.NET MAUI

using Microsoft.Extensions.Logging;
using Plugin.LocalNotification;
using Plugin.LocalNotification.Core;

public static class MauiProgram
{
	public static MauiApp CreateMauiApp()
	{
		var builder = MauiApp.CreateBuilder();
		builder
			.UseMauiApp<App>()
			...
			.UseLocalNotification();

#if DEBUG
		LocalNotificationLogger.LogLevel = LogLevel.Debug;
		builder.Logging.AddDebug();
		builder.Services.AddLogging(configure => configure.AddDebug());
#endif

        	return builder.Build();
	}
}

Xamarin.Forms (Support ended on May 1, 2024)

using Plugin.LocalNotification.Core;

public partial class App : Application
{
    public App()
    {
        InitializeComponent();

        MainPage = new NavigationPage(new MainPage());

        LocalNotificationLogger.Logger = new DebugLoggerProvider().CreateLogger("LocalNotification.Sample");
    }
}

Clone this wiki locally