In my previous articles listed below, we learned how to create Azure App Service web app.
- Azure App Service: Create Web App from Visual Studio
- Azure App Service - Configure Existing Application from Visual Studio
Prerequisites
- Azure Account
- 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.
- Detailed Error Logs: These error logs provide us information about all the HTTP errors that are generated.
- Failed Request Tracing: These logs helps us understand the reasons for all the failed requests.
- Web Server Logging: These logs provide information about all the events that occur on the server like number of requests, IP Address of the user who made the requests etc.
Let’s see how to enable Web Server Logs for Azure App Service in this article.
Navigate to the App Service to which you would like to enable the Web Server Logs and go to “All Settings” and click on “Diagnostic Log” as shown below.
Now, in the “Logs” blade, select “File System” for the “Web server logging” field. By default, the “Web server logging” is “Off”,
Now, click on “Save” button to save the changes.
After a few seconds the “Web server logging” is enabled for the App Service.
Below is the screen capture of the root folder of the App Service taken from FileZilla.
Now, let’s access the App Service by clicking on “Browse” button and see what happens.
The site will be displayed as shown below.
Now, Let’s go to FileZilla refresh as shown below.
As shown below, a folder named “http” is created the root folder.
The “http” folder contains another folder named “RawFiles” which is the place where all the Logs are created as shown below.
Below is the glimpse of .log file.
- 1st Line – Browser name.
- 2nd Line – Column headings of the request details.
- 3rd Line – Values – These are all the values of the request details.
It’s not easy to view and understand the Logs in a text file. It would be really nice to have a tool that displays the data in a readable format. Azure provides a lot of Site Extensions that we could install to our App Service. Once such extension is “Log Browser”. Please have a look at the below article on how to install the extension to your App Service and view the Log data.
Hope you enjoyed the article. Your feedback is highly appreciated.