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

AI

Model Context Protocol (MCP): The Future of AI Integration

April 21, 2025
156
Azure

Step-by-Step Guide: Azure Front Door + Storage Account Static Website + Custom Domain with Terraform

March 11, 2025
372
Network Security & Route Tables – Checking NSGs, route tables, and service endpoints for a targeted VNET or Subnet
Azure

Network Security & Route Tables – Checking NSGs, route tables, and service endpoints for a targeted VNET or Subnet

February 3, 2025
147
Understanding Generative AI and RAG Benefits
AI

Understanding Generative AI and RAG Benefits

January 12, 2025
104
Azure Communication Services Email Sending Simplified: From Setup to Execution and Monitoring
Azure

Azure Communication Services Email Sending Simplified: From Setup to Execution and Monitoring

December 8, 2024
1.7k
PowerShell Automation for Azure Networks: Detailed VNET and Subnet Analysis
Azure

PowerShell Automation for Azure Networks: Detailed VNET and Subnet Analysis

November 2, 2024
545
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

Win a free certifications at the Microsoft spring skills challenge  🎁

Win a free certifications at the Microsoft spring skills challenge 🎁

March 20, 2022
539
Finally Azure Static Web Apps no more in Preview!

Finally Azure Static Web Apps no more in Preview!

May 15, 2021
1.1k
Hello Microsoft Graph !

Hello Microsoft Graph !

February 25, 2021
530

Step-by-Step Guide: Azure Front Door + Storage Account Static Website + Custom Domain with Terraform

March 11, 2025
372
Azure Function to Upload Data to Azure Blob

Azure Function to Upload Data to Azure Blob

August 29, 2020
3.5k
DevOps : Deploy infrastructure using Terraform and Azure DevOps pipelines

DevOps : Deploy infrastructure using Terraform and Azure DevOps pipelines

June 2, 2021
4.6k
Facebook Twitter LinkedIn Youtube

Model Context Protocol (MCP): The Future of AI Integration

April 21, 2025

Step-by-Step Guide: Azure Front Door + Storage Account Static Website + Custom Domain with Terraform

March 11, 2025
Network Security & Route Tables – Checking NSGs, route tables, and service endpoints for a targeted VNET or Subnet

Network Security & Route Tables – Checking NSGs, route tables, and service endpoints for a targeted VNET or Subnet

February 3, 2025

Categories

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