Azure App Service - Configure Detailed Error Logging

In my previous articles listed below, we have learned how to create Azure App Service web app.

  1. Azure App Service: Create Web App from Visual Studio
  2. Azure App Service - Configure Existing Application From Visual Studio

Prerequisites

  1. Azure Account
  2. FileZilla

Azure allows us to enable the Web Server diagnostic services for debugging and troubleshooting for all the App Services. Below are the different types of services that Azure App Service provides us.

  1. Detailed Error Logs – These error logs provide information about all the HTTP errors generated.
  2. Failed Request Tracing – These logs help us understand the reasons for all the failed requests.
  3. Web Server Logging – These logs provide information about all the events that occur on the server, like number of requests, and IP Address of the user who made the requests etc.

Let’s see how to enable Detailed Error Logs for Azure App Service. Before you enable the Error logs, please have a look at the folder structure of the App Service Web App that I have created.

Root Folder

Root Folder

Log Files Folder

Log Files Folder:

  • Log Files – This folder contains most of the Log information that server generates.
  • Site – This folder mostly contains Codebase of our Web App.


Login to the Azure Management portal and navigate to the settings of the App Service Web App for which you would like to enable the Detailed Error logs, as shown below.

Now, click on “Diagnostic Logs”, as shown below.

Diagnostic Logs

You will be taken to the “Logs” blade, as shown in the below screen capture.

By default, the “Detailed error messages” are turned off. Click on the “On” toggle button of the “Detailed error messages”, as shown below, and click on “Save” button.

Logs

You have now turned on the “Detailed Error messages”. Let’s now access the App Service – Web App.

Web App

Now, go back to the FileZilla and refresh the folder contents, as shown below.

contents

You will see a new folder named “Detailed Errors”, as shown below.

Detailed Errors

Navigate to  the “Detailed Errors” folder to view the errors that have been generated by the App Service.

Detailed Errors

I have downloaded the “ErrorPage000001.htm” into my local machine and here is the screen capture of the same when page is opened in browser.

ErrorPage000001

The error was because of a missing file named “Favicon.ico”, for this App Service, though this is a basic example of error logging. In real time, by looking at these error logs, you can take upfront  actions way before your client or the user complains about these HTTP errors.

Hope you enjoyed the article, your feedback is highly appreciated.


Similar Articles