Search code examples
blazorblazor-server-sideconsole-output

Where I can find the Console.WriteLine output from the Blazor Server App?


I have the Blazor component library, I need to debug it. The library can be used in Blazor WASM and Blazor Server-Side Apps. For debug purposes I do some console output:

Console.WriteLine("Hello!") 

In the Blazor WASM app I can see it in the Browser Console.

Where can I see it in case of Blazor Server-Side App? Is using of the Debug.WriteLine method the only way to see the output? Is there a common way to write debug information for both Blazor WASM and Server-Side?

PS: There is no Console output in Debug window in case of Blazor Server-Side App.


Solution

  • .NET6

    If you are using Visual Studio on Windows, try selecting the name of the project when debugging Blazor Server App.

    https://ibb.co/MpnG7qT

    A console window will open and this is where your standard output is redirected. Anything you output from Console.WriteLine is shown there. What you write with Console.WriteLine is output to a standard output. In case of Linux app this would be terminal output.

    .NET7

    There are new options. If you select http or https in the same menu the console will appear (VS 17.9.3)

    .NET