this post was submitted on 11 Jan 2024
1 points (66.7% liked)

.NET MAUI

113 readers
2 users here now

founded 10 months ago
MODERATORS
 

I'm just trying out the built-in builder.Logging.AddDebug(); in a MAUI app, but don't see the output anywhere. From several blogs I expected to see the messages in the Visual Studio Debug output window, but they aren't appearing.

Just using the stock-standard MAUI app, the only changes I have made are in App.cs as follows...

using Microsoft.Extensions.Logging;
using Microsoft.Maui.Controls;
namespace BaseMAUIApp;
internal class App :Application
{
public App(ILogger<App> logger) {
    logger.LogDebug("******************* Message from logger!");
// rest of code...

But I don't see my message anywhere. Is there something else I have to configure, or somewhere else I have to look?

top 1 comments
sorted by: hot top controversial new old
[–] SmartmanApps 1 points 9 months ago

I got the solution from someone on Mastodon. Add the following line to MauiProgram.cs and it works...

builder.Logging.SetMinimumLevel(LogLevel.Debug);