This article has the goal to show how to see the log files from an Azure Mobile Service.
In Azure Portal, each Azure Mobile Service has a separator that show all logs registered (Figure 1), and in possible to see the details for each one (Figure2):
Figure 1: The logs
Figure 2: The details
This information is very useful and allow to know why the system is down or allow to verify if there is any issue. This page allow to list and see the details for each one, but if we want to export logs, the Azure Portal do not allow it. In this article we will see a solution to get all the log files.
Kudu is the engine behind Git deployments in Azure Web Sites, and Azure Mobile Services is not more that an extension of ASP.Net WebApi, this way the deployment used in both is the same.
The Kudu project is available in GitHub in this reference github.com/projectkudu/kudu which wiki contains all documentation about it. For each website 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: The 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 following:
Figure 4: Selecting PowerShell
The following page will be showed
Figure 5: The powershell
Like we can see in the table, we have a LogFiles folder but this contains some logs (logs from Kudu and logs from the application). To see the log, we saw in the Azure Portal, we need to do “cd logfiles” and “cd application” as in the following Figure 6:
Figure 6: the log file
Using the options in the left we can see the logs and then get it, as following:
Figure 7: The log file
In conclusion, we can conclude to get the log files in Azure Mobile Service server is very simple and in some cases can be useful, but each developer should be aware the changes made has impact in the logs separator in the Azure Portal.