Check out what’s new from Firebase at Google I/O 2022. Learn more

Customize your Firebase Crashlytics crash reports

This guide describes how to customize your crash reports using the Firebase Crashlytics SDK. By default, Crashlytics automatically collects crash reports for all your app's users (you can turn off automatic crash reporting and enable opt-in reporting for your users instead). Crashlytics provides four logging mechanisms out of the box: custom keys, custom logs, user identifiers, and caught exceptions.

Add custom keys

Custom keys help you get the specific state of your app leading up to a crash. You can associate arbitrary key/value pairs with your crash reports, then use the custom keys to search and filter crash reports in the Firebase console.

  • In the Crashlytics dashboard, you can search for issues that match a custom key.
  • When you're reviewing a specific issue in the console, you can view the associated custom keys for each event (Keys subtab) and even filter the events by custom keys (Filter menu at the top of the page).

When called multiple times, new values for existing keys will update the value, and only the most current value is captured when a crash is recorded.

Crashlytics.SetCustomKey(string key, string value);

Add custom log messages

Logged messages are associated with your crash data and are visible in the Firebase Crashlytics dashboard when viewing a specific crash.

Crashlytics.Log(string message);

Set user identifiers

You can use an ID number, token, or hashed value to uniquely identify the end-user of your application without disclosing or transmitting any of their personal information. You can also clear the value by setting it to a blank string. This value is displayed in the Firebase Crashlytics dashboard when viewing a specific crash.

Crashlytics.SetUserId(string identifier);

Report non-fatal exceptions

Log custom exceptions in C# using the following methods:

Crashlytics.LogException(Exception ex);

Custom exceptions can be included in your app’s try/catch blocks:

try {
    myMethodThatThrows();
} catch (Exception e) {
   Crashlytics.LogException(e);
   // handle your exception here!
}

Enable opt-in reporting

By default, Crashlytics automatically collects crash reports for all your app's users. You can give users more control over the data they send by letting them opt-in to reporting crashes.

To disable automatic collection and initialize Crashlytics only for selected users, call the Crashlytics data collection override at runtime. The override value persists across launches of your app so Crashlytics can automatically collect reports. To opt out of automatic crash reporting, pass false as the override value. When set to false, the new value does not apply until the next run of the app.

Crashlytics.IsCrashlyticsCollectionEnabled = true

Manage Crash Insights data

Crash Insights helps you resolve issues by comparing your anonymized stack traces to traces from other Firebase apps and letting you know if your issue is part of a larger trend. For many issues, Crash Insights even provides resources to help you debug the crash.

Crash Insights uses aggregated crash data to identify common stability trends. If you’d prefer not to share your app's data, you can opt-out of Crash Insights from the Crash Insights menu at the top of your Crashlytics issue list in the Firebase console.