How to debug issues with Azure Web Apps Part 2 – Monitoring your webapp
Just like any application in Production it’s always good to be prepared for issues and with an Azure Web App knowing how to set up logging so that you can find errors and try to diagnose what’s going on is very important.
In this blog post I’ll cover how to go about diagnosing errors and trying to figure out how to resolve issues.
First off if you have a web app created in Azure then under Monitoring look for Diagnostic Logs
By default all of these are off, so in order to capture Application logging and Web Server Logging we need to turn these on like so: –
Now that we have logging turned on its time to view some logs and we can do this by browsing to our site and then also trying to browse to a page that doesn’t exist and then check the log files.
Once I have browsed to the app I can view the log files by clicking Advance tools in the portal and again using Kudu, this time once Kudu loads, select the following: –
- Select Debug Console and then select CMD
- Click on Log files and then Application
- Then click to download the log file by selecting the download icon as shown below
And now we can view the log files generated from the Application Logging change we made to enable this.
In order to see IIS web logs you need to follow these steps if you chose Web Server Logging (FileSystem)
- Select Debug Console and then select CMD
- Click on Log files, http and then RawLogs
- Then click to download the log file by selecting the same icon in the previous step
Ok one last thing to show before I wrap up this blog post is Log Stream within Azure.
Log stream allows you to view either the application logs or web server logs as a stream (in real-time).
So if I have an issue on the website and I wanna quick look at what’s going on here is how to use Log Stream in Azure.
- Find your web application within the Azure Portal
- Under Monitoring click on Log Stream
- Choose Application logs
- Browse around your app
- Watch the screen fill up with the logging information in real-time
Hopefully this will be of some use to people, enjoy.
[…] How to debug issues with Azure Web Apps Part 2 – Monitoring your webapp (Gregor Suttie) […]