Storing App Service application logs in Blob
Published Apr 20 2023 02:32 AM 6,537 Views

Azure provides built-in diagnostics to assist with debugging an App Service web app. The primary aim of this blog is to guide one step-by-step to add instrumentation to your application, as well as how to access the information logged.

 

Step 1:

Go to >App Service Logs> Enable Application Logging (Blob) and select the desired Blob Storage and the Container and select the Level of logging.

 

AmritpalSinghNaroo_0-1681981781531.png

 

For more information on different types of logs you can refer this document.

 

Step 2:

Below is the code snippet of a .Net Core MVC web application we have deployed in a Windows App Service.

 

 

 

 

 public IActionResult Index()
        {
            _logger.LogInformation("This is a test to send logs to : Blob ");

            return View();
        }

        public IActionResult Privacy()
        {
            return View();
        }

 

 

 

Below are different level of logs details which you can log:

 

AmritpalSinghNaroo_2-1681979247781.png

 

Note: If you write logs to blobs, the retention policy no longer applies if you delete the app but keep the logs in the blobs. For more information, see Costs that might accrue after resource deletion.

 

Step 3:

Go to Storage Account> Container and select the folder with your app service name and download the ( .txt ) file to check the logs.

 

AmritpalSinghNaroo_3-1681979247784.png

 

The Blob option also includes additional information in the log messages, such as the ID of the origin VM instance of the log message (InstanceId), thread ID (Tid), and a more granular timestamp (EventTickCount) in a ( .csv ) file.

 

More information:

 

If you have any other questions, feel free to comment below!

Version history
Last update:
‎Apr 24 2023 07:23 AM
Updated by: