Add custom data to crash reports
Add custom data to crash reports
Although Splunk MINT collects plenty of data associated with each crash of your app, you can collect additional custom data. To add custom data to your crash reports, use the extra data map or add data as key-value pairs. The maximum length of keys is 128 characters. The maximum length of values is 256 characters. The maximum number of extra data key-value pairs is 32.
- To add key-value pairs to the extra data map, use the addExtraData(key, value) method as follows :
- Get the extra data map by using the getExtraData() method.
- To remove a specific value from the extra data, use the removeExtraData(key) method as follows:
- To clear the extra data completely, use the clearExtraData() method as follows:
Mint.addExtraData("level", "second level"); Mint.addExtraData("difficulty", "impossibruuu");
HashMap<String, Object> extras = new HashMap<String, Object>(); extras = Mint.getExtraData();
Mint.removeExtraData("difficulty");
Mint.clearExtraData();
View custom data
To view the custom data in a crash report in Splunk MINT Management Console:
- Go to the Errors dashboard and select an error.
- In the error details section, click the Error Instances tab.
- In the Show All column, click the arrow.
To view the custom data for all of your mobile apps, run a search in the Splunk MINT App. For example, the following search lists errors with the values of the custom "level" field:
sourcetype=mint:error | table message, extraData.level
For more about running searches in MINT, see Searches in the Splunk MINT App User Guide.
Example code
public MyActivity extends Activity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // TODO: Update with your API key Mint.initAndStartSession(this.getApplication(), "YOUR_API_KEY"); Mint.addExtraData("loginfrom", "Facebook"); Mint.addExtraData("gender", "male"); } // Called when the user presses the Logout button public void userLogout() { Mint.removeExtraData("loginfrom"); Mint.removeExtraData("gender"); // OR: Mint.clearExtraData(); } }
Report ANRs | Add breadcrumbs to crash reports |
This documentation applies to the following versions of Splunk MINT™ SDK for Android (Legacy): 5.2.x
Feedback submitted, thanks!