Query about Logging in Blazor Server on Azure

SandeepG 41 Reputation points
2022-05-16T19:50:40.94+00:00

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.

Blazor
Blazor
A free and open-source web framework that enables developers to create web apps using C# and HTML being developed by Microsoft.
1,372 questions
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
6,793 questions
0 comments No comments
{count} votes

Accepted answer
  1. Takahito Iwasa 4,841 Reputation points MVP
    2022-05-16T21:05:24.943+00:00

    Hi, @SandeepG

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

    https://learn.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.

    0 comments No comments

0 additional answers

Sort by: Most helpful