Today, I just finished an application that allow you to get the logs of your Azure Mobile Service.
I think many of mobile service developer use massively the logs on the Azure Mobile Service to debug or just to see the activity of there Mobile Service.
In this post, we will see the different way that exist to read the log and how you can use my app to keep a backup of the log and query the data.
How to read the Mobile Service Log
Using the Portal
Indeed, I used to read the log using the Azure Management Portal, but if you have a lots of log, you will spend a lot of time on the portal that is not really usefull. The portal display the log using a pagination that contains only 20 records.
Using the CLI
You can also use the Azure CLI to display the log, once you’ve set your subscription and account, the command line
azure account log <mobileServiceName>
will show you the log entries with 10 records (by default)
you can use the continuation token to continue through the pagination.
On the CLI, you’ve the ability to add some filters like type, source or message content. For example, you can use the following command :
azure account log <mobileServiceName> –type “information”
To see all the message of type information. (Be carefull, it’s case sensitive). Type are information, error, warning.
The “—query” parameter allows you to use a OData query to filter the log. But you don’t have access to all the parameters to filter. For example, you can’t filter using the date. Things that could be very useful . After talking with MS/MVP folk this summer, it ‘s seems that indeed, this feature is not implemented on server side.
So I decided to create a WPF project that allow me to :
- display the mobile service available in my subscription
- display the log of a mobile service
- download the log for offline viewing
- query the log without any limit.
The Azure Mobile Service Log Viewer was born… (I hope this name is not protected)
How To use Azure Mobile Log Viewer
So once you’ve downloaded the MSI on codeplex, you can install the Application. This application contains :
- an IHM that allow the user to select suscription, mobile service and filter the log
- a mdf database to save the data locally (this db is install in %AppData% folder)
once the app is launched, you will have this beautiful screen with 4 parts:
- First part : the toolbar
The toolbar allow you to import Publish Profile Settings in the application. This will save the Id, Name and Cert use for manage the subscription.
NB: This is the Subscription Profile Settings, not a publish profile from Azure Web Site
- Second part : the mobile service selector and the filters
In this part, you will :
- select the subscription, this will update the Mobile Service Name available for this subscription
- Select the Mobile Service Name, this will call the API to get the log and download them in the Db. If Refresh is activated, the call will be done every minutes to update the view. If not, you have to use the Load Button to refresh the data
- Filter the data using the Date Filter or the Type. These two filters will automatically apply when selected
- You can enter a string in the Text Box and then click on search to apply on the text attribute.
- The number of rows that result for the filter is displayed.
- The button reset allow you to reset the filter
- Third part : the log viewer
It will show you the log data. You can ordering the column as you like.
- Fourth part : the notification bar
The notification bar display some progress bar and text about the different loading processes and the next update date (in case of automatic refresh)
It’s a first version of the application. If some people are interested in this app, I will continue the development. So don’t hesitate to give me feedback on error in the application(and also when it’s work well)
Hope this app will help you.