-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MAUI : LogMessage are not showing up anywhere #7821
Comments
@nssidhu thanks for contacting us. Are you configuring a logging provider? Unlike asp.net core or blazor webassembly, I don't believe .NET Maui apps register a default ILoggerProvider implementation. |
No I am not doing anything extra when compared to Blazor Wasm. |
I just started taking a look at this and here's what I've found so far. I've tested a default MAUI / MAUI Blazor app by selectively adding certain loggers (or none at all) in services.AddLogging(logging =>
{
logging.AddDebug();
//logging.AddConsole();
//logging.AddSimpleConsole();
//logging.AddSimpleConsole(o => o.ColorBehavior = LoggerColorBehavior.Disabled);
});
Notes:
|
Thanks for looking at this. I really Like the Blazor Hybrid approach over XAML Native, this is opening up the doors for Web Developers to write Native Mobile Apps as well ability to write once and run everywhere. !! Great work and kudos to entire team !! Few question I had to use builder prefix to service, which is different than what you have provided above.
Do I need to install any nuget package to get this working ? Severity Code Description Project File Line Suppression State |
@nssidhu for the Debug logger, add a reference to this package: https://www.nuget.org/packages/Microsoft.Extensions.Logging.Debug And you're right, in my case I had an extra variable to shorten the syntax. By default in MauiProgram.cs you would need to do |
The grid above is now filled out. |
This comment was marked as outdated.
This comment was marked as outdated.
Not sure what I was thinking earlier, but for some reason I thought we needed to conditionally add debug vs. console loggers. I completely forgot that the Debug logger just works everywhere! So my proposal is quite simple: The various .NET MAUI project templates need two changes:
And that will enable a good default logging experience on every platform. The code of the |
PR to call |
Description
I am using Inject ILogger and writing log message, but i don't see any output anywhere.
public ILogger _Logger { get; set; }
Is there something else to be configured in Blazor MAUI ?
Steps to Reproduce
Version with bug
6.0 (current)
Last version that worked well
Unknown/Other
Affected platforms
Android, Windows
Affected platform versions
Android emulator
Did you find any workaround?
No
Relevant log output
The text was updated successfully, but these errors were encountered: