I usually do something like this:
Console.WriteLine("My debug output.");
if it’s Blazor WebAssembly, I see the message in the browser´s console.
If it’s Blazor Server App I see the message in the Output window. (In the output window, there is a dropdown – select: ” ASP.NET Core Web Server”).