Troubleshoot- logging python Application errors on Azure Web/API Apps
After creating a Azure Web/API app using python, you may end-up getting below 500 error at some point of your application development process. This Blog describes how to enable Application logs for a python Web/API APP on Azure.
The page cannot be displayed because an internal server error has occurred.
If you have worked earlier on Azure Web app, General tendency would be to look at LogFiles folder in kudu console(https://Your_Website.scm.azurewebsites.net) but that won't provide you much info about python application issue.
To overcome this, Please follow below set of instructions to receive application logs
1) Navigate to your new azure portal and click on settings in your Web app.
2) Click on Application Settings in Settings Tab
3) Enter Below Key/Value pair under App Settings in Application Settings Tab.
Key : WSGI_LOG
Value : D:\home\site\wwwroot\logs.txt - (Enter your choice of file name here)
4) Now you should be able to see logs.txt file in wwwroot folder as mentioned in above step
If you still haven't found that logs.txt file, check if ptvs_virtualenv_proxy.py file is similar to below link content.
Find more details on using Python in Azure Web/API Apps at below links :
- Python Developer Center - http://azure.microsoft.com/en-us/develop/python/
- Configuring Python in Azure Web Apps - https://azure.microsoft.com/en-us/documentation/articles/web-sites-python-configure/