Catch up on everything announced at Firebase Summit, and learn how Firebase can help you accelerate app development and run your app with confidence. Learn More

Customize your Firebase Crashlytics crash reports

Stay organized with collections Save and categorize content based on your preferences.

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.

Report exceptions

Report caught exceptions

If you have exceptions that are expected, you can have the Crashlytics SDK report them as non-fatal events. These events are logged on device and then sent along with the next fatal event report or when the end-user restarts the game.

You can log exceptions in C# using the following method:

Crashlytics.LogException(Exception ex);

You can log expected exceptions in your game's try/catch blocks:

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

Report uncaught exceptions

For uncaught exceptions that don't crash your game (for example, uncaught C# exceptions in game logic), you can have the Crashlytics SDK report them as fatal events by setting the Crashlytics.ReportUncaughtExceptionsAsFatal property to true where you initialize Crashlytics in your Unity project . These events are reported to Crashlytics in real-time without the need for the end-user to restart the game.

Reporting these uncaught exceptions as fatal events means that they'll count in your crash-free user statistics and towards velocity alerts.

Note that native crashes are always reported as fatal events. These events are logged on device and then sent along when the end-user restarts the game.

void Start() {
    // Since there is no try-block surrounding this call, if an exception is thrown,
    // it is considered unexpected.
    // Setting `Crashlytics.ReportUncaughtExceptionsAsFatal = true`
    // will ensure that such cases are reported as fatals.
    thirdPartyMethodThatMayThrow();
}

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

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.