Scope

This article explains how to view the log files from an Azure Mobile Service.

Introduction

In Azure Portal, each Azure Mobile Service has a tab which shows all log entries (Figure 1), and it is possible to see the details for each one (Figure2):

The logs

Figure 1: The logs

The log details

Figure 2: The details

This information is very useful and allows us to work out why the system is down or obtain further information about an issue. This page shows a list and allows us to view the details for each one.  Azure Portal does not allow the export of this data.
This article explains how to obtain those log files.

 Description

Kudu is the engine behind Git deployments in Azure Web Sites, and Azure Mobile Services is not more than an extension of ASP.Net WebApi, this way the deployment used in both is the same.

The Kudu project is available in GitHub from github.com/projectkudu/kudu the wiki contains documentation. 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 Kudu page we need to use https://mymenuapp.scm.azure-mobile.net and we will get
something like in Figure 3:

The Kudu main page
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:

Selecting PowerShellFigure 4: Selecting PowerShell

The following page will be shown:

Selecting PowerShell
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:

Selecting PowerShell
Figure 6: the log file

Using the options in the left we can see the logs and then get it, as following:

Selecting PowerShell
Figure 7: The log file

Conclusion 

In conclusion, we have seen obtaining the log files from Azure Mobile Service server is very simple, once you know how. Any developer should be aware that changes made will impact the logs tab in the Azure Portal.

shopify analytics