Finding Verbose Error Logs in Azure Websites

 

Anyone who has spent hours and hours trying to debug problems from a web app can relish in seeing a healthy app. But getting there is often incredibly difficult. Recently, I was working on putting my first Flask Web App into Azure – a pretty basic to-do app that connects to the MongoAPI in CosmosDB – and was using Github Continuous Integration. I put in all of my app settings and keys, copied the tutorials on setting up the virtual python environments but I kept getting this INTERNAL SERVER ERROR.

After scouring through Azure to see what was wrong, never finding verbose enough errors, I finally landed on the jackpot. In all honesty, I probably should have started here, but for some reason I thought going into Kudu and doing every test known to man was a good idea.  Azure is constantly adapting, so this newer Diagnose tool is a GOD SENT

But to save others from the pain – here’s a quick guide to finding a more verbose log file for Azure Websites:

  1. Go to your Azure App Service and look for the Diagnose and solve problems tab.
  2. On the right hand side, under Tools, click Failed Request Tracing Logs
  3. This will open up a page with all of the failed request logs. Click on one of the .xml files to view the logs.
  4. Review the errors.Error Logs

Now this isn’t going to solve all of your problems with your application, but it definitely gave me a much more verbose reason to what wasn’t working. I was able to then change these specific lines of code to eventuall get it working. In the end, my Python virtual environment wasn’t named correctly so the site was never able to spin up. You can check out the repo here and see how to deploy it to Azure.