Achraf Ben Alaya
No Result
View All Result
  • News
  • Blog
    • blazor
    • c#
    • Cloud
      • Azure
    • docker
    • sql
    • xamarin
    • Dapr
    • Tricks, Tips and Fixes
  • Cloud
  • Motivation
  • General Tips & Fix
  • Exam Preparation
    • AZ-104
    • AZ-400
  • About
    • Resume
SUBSCRIBE
  • News
  • Blog
    • blazor
    • c#
    • Cloud
      • Azure
    • docker
    • sql
    • xamarin
    • Dapr
    • Tricks, Tips and Fixes
  • Cloud
  • Motivation
  • General Tips & Fix
  • Exam Preparation
    • AZ-104
    • AZ-400
  • About
    • Resume
No Result
View All Result
Achraf Ben Alaya
No Result
View All Result
ADVERTISEMENT
Home Blog Cloud Azure

Configure Azure Web App Logging With .NET 5

achraf by achraf
December 11, 2020
in Azure, Blog, Cloud
2 min read
0
Configure Azure Web App Logging With .NET 5
0
SHARES
1.7k
VIEWS
Share on FacebookShare on Twitter

The Azure App Service web apps provide diagnostic functionality for logging information from both the web server and the web application. It logically separates this into web server diagnostics and application diagnostics. When you enable this feature in Azure, you can specify a log data storage account and container for each of these to save them .

Full demo : 

 

 

Enable the filesystem logs on Azure Portal

In order to activate the logs here , after you create the web application ,we need to go to Monitoring and go to App Service logs  and we need to activate Application Logging (Filesystem) and change Web server logging to File System .

Add the configuration code

First of all ,we need to install the package  : Microsoft.Extensions.Logging.AzureAppServices from this link .
Next we are going to do some changes inside the Program.cs

public class Program
  {
      public static void Main(string[] args)
      {
          CreateHostBuilder(args).Build().Run();
      }

      public static IHostBuilder CreateHostBuilder(string[] args) =>
      Host.CreateDefaultBuilder(args)
           .ConfigureWebHostDefaults(webBuilder =>
           {
               webBuilder
               .UseStartup<Startup>()
               .ConfigureLogging(logging =>
               {
                   logging.ClearProviders();
                   logging.AddConsole();
                   logging.AddAzureWebAppDiagnostics();
               });
           });
  }

 

Add Logs

Inside our controllers , we will find already the logs implemented ,all we need to do is to add few lines depends of the type of the logs that you want to write :

_logger.LogInformation("LogInformation  WeatherForecast");
_logger.LogWarning("LogWarning  WeatherForecast");
_logger.LogDebug("LogDebug  WeatherForecast");

 

Watch our logs

 

Well , that was our quick demo about the logs on azure ,to read more about it on Microsoft website link

ShareTweet
Previous Post

FIX – YouTube Thumbnail Not Showing on Facebook

Next Post

Recover a deleted storage account azure

Related Posts

Switch to Azure Container Registry from Docker Hub
Azure

From Docker Hub, switch to Azure Container Registry & AKS

January 16, 2023
132
How to setup nginx reverse proxy && load balancer for aspnet core apps with Docker and azure kubernetes service (AKS)
Azure

How to configure an ingress controller using TLS/SSL for the Azure Kubernetes Service (AKS)

November 25, 2022
229
How to setup nginx reverse proxy && load balancer for aspnet core apps with Docker and azure kubernetes service (AKS)
Azure

How to setup nginx reverse proxy && load balancer for aspnet core apps with Docker and azure kubernetes service (AKS)

November 23, 2022
102
How to setup nginx reverse proxy for aspnet core apps with and without  Docker compose
Azure

How to setup nginx reverse proxy for aspnet core apps with and without Docker compose

November 23, 2022
153
Win free certifications at the Microsoft Build Cloud Skills Challenge | May 2022 🎁
Blog

Win free certifications at the Microsoft Build Cloud Skills Challenge | May 2022 🎁

May 28, 2022
107
Generating report for SSL Certificates for Websites with PowerShell
Azure

Generating report for SSL Certificates for Websites with PowerShell

April 10, 2022
386
Next Post
Recover a deleted storage account azure

Recover a deleted storage account azure

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Terraform

Certifications

Microsoft certified trainer (MCT)

Recommended

Why you need to ensure updating your Xamarin.Android Application to Supports 64-Bit Devices and how to do that .

Why you need to ensure updating your Xamarin.Android Application to Supports 64-Bit Devices and how to do that .

April 21, 2020
322
Migrate and modernize your applications on Azure – Part –1 (Migrate Database)

Migrate and modernize your applications on Azure – Part –1 (Migrate Database)

April 3, 2021
248
Sql tips and tricks

Sql tips and tricks

April 26, 2020
161
#msbuild registration is now open!

#msbuild registration is now open!

April 29, 2021
175
Goodbye my lover Xamarin, Hello MAUI!

Goodbye my lover Xamarin, Hello MAUI!

September 25, 2020
439
Configure Azure Web App Logging With .NET 5

Configure Azure Web App Logging With .NET 5

December 11, 2020
1.7k
Facebook Twitter LinkedIn Youtube
Switch to Azure Container Registry from Docker Hub

From Docker Hub, switch to Azure Container Registry & AKS

January 16, 2023
How to setup nginx reverse proxy && load balancer for aspnet core apps with Docker and azure kubernetes service (AKS)

How to configure an ingress controller using TLS/SSL for the Azure Kubernetes Service (AKS)

November 25, 2022
How to setup nginx reverse proxy && load balancer for aspnet core apps with Docker and azure kubernetes service (AKS)

How to setup nginx reverse proxy && load balancer for aspnet core apps with Docker and azure kubernetes service (AKS)

November 23, 2022

Categories

  • Apps (1)
  • Azure (39)
  • blazor (2)
  • Blog (62)
  • c# (7)
  • Cloud (37)
  • Dapr (4)
  • docker (3)
  • Games (1)
  • General Tips & Fix (1)
  • Motivation (3)
  • motivation (2)
  • News (9)
  • Resume (1)
  • sql (4)
  • Tricks, Tips and Fixes (3)
  • xamarin (5)
No Result
View All Result
  • News
  • Blog
    • blazor
    • c#
    • Cloud
      • Azure
    • docker
    • sql
    • xamarin
    • Dapr
    • Tricks, Tips and Fixes
  • Cloud
  • Motivation
  • General Tips & Fix
  • Exam Preparation
    • AZ-104
    • AZ-400
  • About
    • Resume