title: How to log in Blazor Wasm in program.cs
body: <p>I found documentation that you can't log directly in your Program.cs file but that it would be possible with a 3rd party library like Serilog. <a href="https://docs.microsoft.com/en-us/aspnet/core/fundamentals/logging/?view=aspnetcore-5.0#log-during-host-construction" rel="nofollow noreferrer">Microsoft Link</a></p>
  <p>After finding out you can't break in your program.cs I tried to add logging to my program.cs.
  This doesn't seem to be working in Blazor WASM.</p>
  <p>I tried it in a DotNet Core WebApi and it works just fine there.</p>
  <p>The code I used in both the API as Blazor project:</p>
  <pre><code>Log.Logger = new LoggerConfiguration()
                 .WriteTo.File(@&quot;hello\world\setup.txt&quot;)
                 .CreateLogger();
  
  Log.Fatal(&quot;Hello friend!&quot;);
  </code></pre>
  <p>To be fair this seems like a bug. I'm looking for a working sample.</p>