question

SandeepG-4375 avatar image
0 Votes"
SandeepG-4375 asked TakahitoIwasa answered

Query about Logging in Blazor Server on Azure

Hi,

I'm quite new to Web-development and Azure. When I'm doing development for Blazor and if there is any error in my components/pages, the Visual studio shows that in the Output window. I am trying to capture such error messages when my App is published on Azure App Service.

What I read from web I can setup logger and write message to log by explicitly calling functions like LogInformation etc. This would be good to write in Catch blocks. However I want logs for error just like VS without specifying any Try-Catch blocks. Basically I want the errors to get logged somewhere on the Azure without me explicitly catching the errors.

Can you please guide me on what I need to use.

Thanks.

azure-webappsdotnet-aspnet-core-blazor
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

TakahitoIwasa avatar image
0 Votes"
TakahitoIwasa answered

Hi, @SandeepG-4375

If you are using App Service, you can enable diagnostic logging by the following method.

https://docs.microsoft.com/en-us/azure/app-service/troubleshoot-diagnostic-logs

If the trace level is low, it may be included in the log automatically output by the framework.
Please let me know if you want to output additional log information.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.