As a Windows Phone developer I always envied Android developers with their quite handy out of the box logging solution, namely LogCat. It allows both to output debug information in real time and to write it somewhere permanently.
With Windows 10 being released I was hoping to have something similar to Android LogCat in Windows. Alas, there are a few changes to ETW Tracing and that’s all. If your have a Windows Phone / Window 8 development experience there is going to be nothing new for you.
The Microsoft way for logging in UWP applications is via Event Tracing for Windows. You can find a corresponding sample from Microsoft on GitHub. This technology has been around both in desktop and mobile versions of Windows for quite some time already.
+ Out of the box. No need to reference any additional libraries.
+ Semantic logging. Your logs are going to have a consistent structure that makes it easier to analyze them.
- Requires an effort to configure.
- By default the result is going to be
*.etl files that have to be decoded.
There are many different third party libraries for logging in Universal Windows applications. The most popular one is MetroLog.
+ Easy to configure.
+ Plain old text files. MetroLog can output to different targets, but it’s really easy to configure it to write everything into a
- Additional reference in your application.
Retrieving logs from a Windows phone
Whether you’re doing ETW tracing or using a third party library (or your own custom solution) you are going to need to retrieve your logs from a device. You can upload them to some server or just prompt users to email them directly to you. In case you have a physical access to a test device the easiest and most convenient way is to use Windows Phone Power Tools. I’ve tested it with Windows 10 Mobile Insider Preview and it works great.
In Visual Studio 2015 Microsoft has added Application Insights into Universal App project template. Application Insights is a comprehensive application monitoring solution available in Azure cloud. It allows to monitor the availability, performance, and usage metrics of different applications and services, and it might help you to solve the problems you wanted to solve with logging.