13

I am using Crashlytics and fatal crashes get delivered. However the data added with

Crashlytics.log(mytext);

is not showing anywhere in Fabric Dashboard.

I couldnt find any hint on a necessary setup or configuration in the docs. What am I missing?

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
michaelsmith
  • 1,011
  • 1
  • 16
  • 35

2 Answers2

19

Mike from Fabric here. Custom logs, keys and user identifiers are included on a per crash basis. To view them, go from your Crashlytics dashboard. and click on a specific issue.

Then click on "View All Sessions"View All sessions

and you'll see the most recent session and specific data:enter image description here

One thing to note is that you need to set this on each launch of the app once you know the values. They are not persisted across multiple launches.

Mike Bonnell
  • 16,181
  • 3
  • 61
  • 77
  • 3
    But how can I see custom logs in dashboard if I do not have any issue? – Krishna Meena Jan 09 '18 at 06:43
  • 1
    That's not possible currently Krishna. Custom logs are only uploaded when non-fatal exceptions or fatal exceptions (crashes) occur in the same app session. – Mike Bonnell Jan 16 '18 at 13:09
  • Hike @MikeBonnell can you elaborate on What you meant by "One thing to note is that you need to set this on each launch of the app once you know the values. They are not persisted across multiple launches." – Ismail Iqbal Jun 18 '18 at 12:40
  • Also @MikeBonnell looks like only couple of lines from the log are visible (2 lines) not all the logs I add to the activity is visible on the above page you mentioned. – Ismail Iqbal Jun 18 '18 at 12:42
  • 2
    Sure, so each time the user launches an app a new record of their logs is created. If no crash happens, then the logs are discarded. For each launch of the app, you would need to re-log the information. – Mike Bonnell Jun 20 '18 at 21:00
3

I was able to get the logs using the following way.

I added an "UPLOAD LOGS" button on my application's settings page so when the user clicks on it the following will happen.

                        Crashlytics.logException(new Exception("Upload Log exception"));
                        Intent mStartActivity = new Intent(thisActivity, SettingsActivity.class);
                        int mPendingIntentId = 123456;
                        PendingIntent mPendingIntent = PendingIntent.getActivity(thisActivity,mPendingIntentId,    mStartActivity, PendingIntent.FLAG_CANCEL_CURRENT);
                        AlarmManager mgr = (AlarmManager)thisActivity.getSystemService(Context.ALARM_SERVICE);
                        mgr.set(AlarmManager.RTC, System.currentTimeMillis() + 200, mPendingIntent);
                        System.exit(0);

The above code would invoke a non fatal exception which will upload all the logs of the current session to crashlytics and then restart the app after 200ms which is a requirement for crashlytic to upload the logs to remote (Because invoking non fatal error does not restart the app like a fatal crash does)

Ismail Iqbal
  • 2,774
  • 1
  • 25
  • 46