Achraf Ben Alaya
No Result
View All Result
  • Home
  • News
  • Blog
    • blazor
    • c#
    • Cloud
      • Azure
    • docker
    • sql
    • xamarin
    • Dapr
    • Tricks, Tips and Fixes
  • Cloud
  • Motivation
  • General Tips & Fix
  • About
    • Resume
SUBSCRIBE
  • Home
  • News
  • Blog
    • blazor
    • c#
    • Cloud
      • Azure
    • docker
    • sql
    • xamarin
    • Dapr
    • Tricks, Tips and Fixes
  • Cloud
  • Motivation
  • General Tips & Fix
  • 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
2.1k
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

 Azure Container Apps : User-Assigned Identity, ACR, and Key Vault
Azure

 Azure Container Apps : User-Assigned Identity, ACR, and Key Vault

November 12, 2023
13
Navigating Azure Identities: System-Assigned vs. User-Assigned with Real-World Scenarios
Azure

Navigating Azure Identities: System-Assigned vs. User-Assigned with Real-World Scenarios

October 9, 2023
64
Revolutionizing IP Management in Azure with IPAM: Explore, Deploy, and Master!
Azure

Revolutionizing IP Management in Azure with IPAM: Explore, Deploy, and Master!

October 4, 2023
100
Configuring GitHub Advanced Security for Azure DevOps: A Must-Have in Today’s DevOps Landscape
Azure

Configuring GitHub Advanced Security for Azure DevOps: A Must-Have in Today’s DevOps Landscape

September 28, 2023
84
The Significance of Azure DevSecOps: Best Practices for Securing Your Pipelines
Azure

The Significance of Azure DevSecOps: Best Practices for Securing Your Pipelines

August 17, 2023
161
Navigating the Alphabet Soup: Unraveling Microsoft Acronyms
Azure

Navigating the Alphabet Soup: Unraveling Microsoft Acronyms

July 16, 2023
82
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

#msbuild registration is now open!

#msbuild registration is now open!

April 29, 2021
197
Dapr – Service Invocation Part 1/2

Dapr – Service Invocation Part 2/2

August 17, 2021
458
Configure Azure Web App Logging With .NET 5

Configure Azure Web App Logging With .NET 5

December 11, 2020
2.1k
Dapr – State management (redis)  Part 1/2

Dapr – State management (redis) Part 1/2

August 17, 2021
597
Deploy azure function from visual studio 2019

Deploy azure function from visual studio 2019

August 29, 2020
474
Auto Post and Schedule Tweets & Linkedin using Azure Logic Apps

Auto Post and Schedule Tweets & Linkedin using Azure Logic Apps

April 14, 2021
421
Facebook Twitter LinkedIn Youtube
 Azure Container Apps : User-Assigned Identity, ACR, and Key Vault

 Azure Container Apps : User-Assigned Identity, ACR, and Key Vault

November 12, 2023
Navigating Azure Identities: System-Assigned vs. User-Assigned with Real-World Scenarios

Navigating Azure Identities: System-Assigned vs. User-Assigned with Real-World Scenarios

October 9, 2023
Revolutionizing IP Management in Azure with IPAM: Explore, Deploy, and Master!

Revolutionizing IP Management in Azure with IPAM: Explore, Deploy, and Master!

October 4, 2023

Categories

  • Apps (1)
  • Azure (52)
  • blazor (2)
  • Blog (76)
  • c# (7)
  • Cloud (50)
  • Dapr (4)
  • docker (4)
  • Games (1)
  • General Tips & Fix (1)
  • Kubernetes Service (AKS) (1)
  • Motivation (3)
  • motivation (2)
  • News (9)
  • Resume (1)
  • sql (4)
  • Terrafrom (1)
  • Tricks, Tips and Fixes (3)
  • xamarin (5)
No Result
View All Result
  • Home
  • News
  • Blog
    • blazor
    • c#
    • Cloud
      • Azure
    • docker
    • sql
    • xamarin
    • Dapr
    • Tricks, Tips and Fixes
  • Cloud
  • Motivation
  • General Tips & Fix
  • About
    • Resume