How to: Enable error and performance logging

Important

Versions of the Microsoft Rights Management Service SDK released prior to March 2020 are deprecated; applications using earlier versions must be updated to use the March 2020 release. For full details, see the deprecation notice.

No further enhancements are planned for the Microsoft Rights Management Service SDK. We strongly recommend adoption of the Microsoft Information Protection SDK for classification, labeling, and protection services.

The Microsoft Rights Management SDK 4.2 manages diagnosis and performance logs upload through a single device property.

Overview

You can improve your users' experience and troubleshooting by enabling automatic diagnostics, performance, and telemetry logging data upload to Microsoft.

Important

In order to honor user privacy, you as the app developer, must ask the user to consent before enabling the automatic logging.

Note

As example, here is a standard message Microsoft uses for logging notification:

By turning on Error and Performance Logging, you are agreeing to send Error and Performance Data to Microsoft. Microsoft will collect error and performance data over the internet (“Data”). Microsoft uses this Data to provide and improve the quality, security and integrity of Microsoft products and services. For example, we analyze performance and reliability, such as what features you use, how quickly the features respond, device performance, user interface interactions, and any problems you experience with the product. Data will also include information about the configuration of your software like the software you are currently running, and the IP address.

You will manager logging control through two properties.

  • Enable logging through the IpcCustomerExperienceDataCollectionEnabled property. The setting is persistent across device resets.

  • Control the logging level through the IpcLogLevel property using the following settings.

    • 1 - Verbose
    • 2 - Informational
    • 3 - Warning
    • 4 - Error
    • 5 - Critical

In each of the example code snippets following, the calling application can set or query the property.

Android

Enable automatic logging

SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
SharedPreferences.Editor editor = preferences.edit();
editor.putBoolean("IpcCustomerExperienceDataCollectionEnabled", true);
editor.commit();

Get current logging control flag setting

SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
Boolean isLogUploadEnabled = preferences.getBoolean("IpcCustomerExperienceDataCollectionEnabled", false);

iOS

Enable automatic logging

NSUserDefaults \*prefs = [NSUserDefaults standardUserDefaults];
    [prefs setBool:FALSE forKey:@"IpcCustomerExperienceDataCollectionEnabled"];
    [[NSUserDefaults standardUserDefaults] synchronize];

Get current logging control flag setting

[[NSUserDefaults standardUserDefaults] boolForKey:@"IpcCustomerExperienceDataCollectionEnabled"];

Set log level control

NSUserDefaults \*prefs = [NSUserDefaults standardUserDefaults];
    [prefs setInteger:1 forKey:@"IpcLogLevel"];
    [[NSUserDefaults standardUserDefaults] synchronize];

Get log level control setting

[[NSUserDefaults standardUserDefaults] boolForKey:@"IpcLogLevel"];

Windows

Enable automatic logging

CustomerExperienceConfiguration::Option = CustomerExperienceOptions::LoggingEnabledNow;

For more information on optional settings, see CustomerExperienceOptions.

Get current logging control flag setting

CustomerExperienceOptions loggingOption = CustomerExperienceConfiguration::Option;

Note - The Windows code snips above are in C++. For C#, update the syntax with ‘.’ in place of ‘::’.

Linux / C++ - This SDK has some basic logging that is not as extensive as that of the other platforms. For more information see the Troubleshooting section of the "README.md" at RMS SDK for portable C++.