Share via


Azure Mobile Services: How to see the log files in server

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):

http://s20.postimg.org/v65xzeual/Log_Files1.jpg

Figure 1: The logs

http://s20.postimg.org/snk8yq8kd/Log_Files2.jpg

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:

http://s20.postimg.org/49qk4u0v1/Log_Files3.jpg
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:

http://s20.postimg.org/tbt3ho7a5/Log_Files4.jpgFigure 4: Selecting PowerShell

The following page will be shown:

http://s20.postimg.org/5q22mz3rx/Log_Files5.jpg
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:

http://s20.postimg.org/sg17fymzh/Log_Files6.jpg
Figure 6: the log file

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

http://s20.postimg.org/rf0yqu5zx/Log_Files7.jpg
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.

http://c.statcounter.com/10308216/0/73e6ea0b/1/