Azure Mobile Services: How to See the Log Files in Server
The purpose of this article is to show how to see the WebConfig file published in Azure Mobile Services.
In Azure Portal, each Azure Mobile Service has a separator that shows all the logs registered (Figure 1), and if possible to see the details for each one (Figure 2):
Figure 1 the logs
Figure 2 the details
This information is very useful and allows us to understand why the system is down or allows verification of any issue. This page allows us to list and see the details for each one, if we want to export the Azure Portal then do not allow it. In this article we will see a solution to get all the log files.
The Kudu project is available in GitHub at the reference github.com/projectkudu/kudu and the wiki contains all the documentation about it. For each website it is possible to access its Kudu using something like https://<Azure Mobile Service Base Url>.scm.azure-mobile.net and the Azure Portal credentials.
Let’s use the Menu App Sample, where the Azure Mobile Service is defined in https://mymenuapp.azure-mobile.net/. To access the Kudo page we need to use https://mymenuapp.scm.azure-mobile.net and we will get something like in Figure 3:
Figure 3 Kudu main page
To see the log files we need to click in “Debug Console” and then we need to choose one of the options, let’s choose “PowerShell” as in the following:
Figure 4 Selection PowerShell
The following page will be shown:
Figure 5 PowerShell
Like we can see in the table, we have a LogFiles folder but this contains some logs (logs from Kudu and the logs in the application). To the logs we saw in the Azure Portal we need to do “cd logfiles” and “cd application” as in the following Figure 6:
Figure 6 the list of logs
Using the options in the left we can see the logs and then get it, as in the following:
In conclusion, we can conclude that getting log files in an Azure Mobile Service server is very simple and in some cases can be useful, but each developer should be aware of the changes made since it has an impact in the logs separator in the Azure Portal.