aspnetcore/blazor/hybrid/troubleshoot.md
xref:Microsoft.AspNetCore.Components.WebView.Maui.BlazorWebView has built-in logging that can help you diagnose problems in your Blazor Hybrid app.
This article explains the steps to use xref:Microsoft.AspNetCore.Components.WebView.Maui.BlazorWebView logging:
BlazorWebView loggingEnable logging configuration during service registration. To enable maximum logging for xref:Microsoft.AspNetCore.Components.WebView.Maui.BlazorWebView and related components under the xref:Microsoft.AspNetCore.Components.WebView?displayProperty=fullName namespace, add the following code in the Program file:
services.AddLogging(logging =>
{
logging.AddFilter("Microsoft.AspNetCore.Components.WebView", LogLevel.Trace);
});
Alternatively, use the following code to enable maximum logging for every component that uses xref:Microsoft.Extensions.Logging?displayProperty=fullName:
services.AddLogging(logging =>
{
logging.SetMinimumLevel(LogLevel.Trace);
});
After configuring components to write log information, configure where the loggers should write log information.
The Debug logging providers write the output using Debug statements.
To configure the Debug logging provider, add a reference to the Microsoft.Extensions.Logging.Debug NuGet package.
Register the provider inside the call to xref:Microsoft.Extensions.DependencyInjection.LoggingServiceCollectionExtensions.AddLogging%2A added in the previous step by calling the xref:Microsoft.Extensions.Logging.DebugLoggerFactoryExtensions.AddDebug%2A extension method:
services.AddLogging(logging =>
{
logging.AddFilter("Microsoft.AspNetCore.Components.WebView", LogLevel.Trace);
logging.AddDebug();
});
When the app is run from Visual Studio with debugging enabled, the debug output appears in Visual Studio's Output window.