Firebase Crashlytics custom log does not appear in the console

31,256

Solution 1

For a better understanding, when you collect data with

FirebaseCrashlytics.getInstance().log("Test w(text)")
FirebaseCrashlytics.getInstance().log("Test e(text)")

you will get NO new non-fatal crash report in Firebase crashlytics. But follow up by a

FirebaseCrashlytics.getInstance().recordException(RunTimeException("Test e(throwable)"))

it will send this error : enter image description here

with this additional log entries within this error

enter image description here

Solution 2

The logging mechanism of Crashlytics isn't built for normal logging.

The logs that you put will show in crash reports, not as stand alone logs. Same goes for the user identifier information.

Try forcing a crash, you should see the logs captured before the crash in the crash report. If you want normal logging, you should look into Firebase analytics, it'll help you keep track of regular events and other analytics data.

Solution 3

This worked for me.

Crashlytics.log(message);
Crashlytics.logException(exception);

Edit: I had missed this explanation.

Solution 4

Just for updating the answer for log Kotlin with Firebase it is:

FirebaseCrashlytics.getInstance().log(error.toString())

And for Exception

FirebaseCrashlytics.getInstance().recordException(e)

See documentation: https://firebase.google.com/docs/crashlytics/get-started?platform=Android

Solution 5

I also had big problems getting anything to show up but I figured it out. In my case the problem was me versus the user interface at the crashlytics site.

You have to disable the filter saying Event Type="Crashes" to be able to see those other events.

Disable the filter here

Share:
31,256
strok_777
Author by

strok_777

Updated on July 15, 2022

Comments

  • strok_777
    strok_777 almost 2 years

    I've been testing Firebase Crashlytics and even though the normal crash report works right I can't success trying to generate a custom as it says the documentation.

    Crashlytics.log(msg); 
    

    I also would like to know wether setting the user identifier for Crashlytics can be done for any crash (according to the doc I've understood that it's possible) with

    void Crashlytics.setUserIdentifier(String identifier); 
    

    and how it would have to be done, because it does neither work to me, I can't see anything on the Firebase crashlytics console.

    Thanks in advance!

    • Amir133
      Amir133 over 5 years
      do you reopen your app? because firebase message sent when you reopen your app!!!
    • Rafael Lima
      Rafael Lima over 2 years
      Crashlytics isn't made for develop logging, it is made to cluster hundreds/thousands of logs from different users at runtime, this may cause that the dashboard doesn't show the logs in the exactly time they are produced. If you want to use Crashlytics to follow the code workflow and debug during development, you will need to use the trick in this answer. stackoverflow.com/a/69340289/5679560
  • strok_777
    strok_777 over 6 years
    Ok, I've seen that setUserIdentifier does add the info on the crash I just provoked. But isn't there any option to add this globally, for any crash occurred? Regarding the log it think there must be a way to generate custom logs, as it can be done with FirebaseCrash.report. Anyway if the purpose of log was to attach it on the crash, in this case it doesn't appear on the console, as it does with the user identifier.
  • Kushan
    Kushan over 6 years
    Unfortunately not
  • matteoh
    matteoh over 4 years
    That what I was missing: Crashlytics.log() alone does nothing, it has to be used with Crashlytics.logException(). Thanks!
  • AhuraMazda
    AhuraMazda about 4 years
    in addition to this, application sends crush reports after restart.
  • Junia Montana
    Junia Montana about 4 years
    Sorry but it just does not do anything at all! Does anybody has any solution for this?
  • Andrew Koster
    Andrew Koster almost 4 years
    "FirebaseCrashlytics" does not exist.
  • Andrew Koster
    Andrew Koster almost 4 years
    "Crashlytics" doesn't exist, this is probably code from the old API.
  • Andrew Koster
    Andrew Koster almost 4 years
    "FirebaseCrashlytics" doesn't exist.
  • Júlio Reis
    Júlio Reis almost 4 years
    @AndrewKoster could you tell me in more details ? My Android app it is working fine with "FirebaseCrashlytics" Did you add it to your app graddle ?
  • Andrew Koster
    Andrew Koster almost 4 years
    The problem is that I was following firebase.google.com/docs/android/setup which does NOT include any of the dependencies required to use Crashlytics itself. I finally found firebase.google.com/docs/crashlytics/… which is complete and accurate. I'll switch my vote if you add that last URL to the answer.
  • Júlio Reis
    Júlio Reis almost 4 years
    @AndrewKoster, sure.
  • heronsanches
    heronsanches almost 4 years
  • hasan
    hasan over 3 years
    I don't understand this bs. Fabric used to have logging that shows when the app crashes. now this needs me to know what is the crash to be able to see the logs. what!?!?
  • hannes ach
    hannes ach over 3 years
    With the log() you collect (pre-)info which you only want to see on a crash. This should help you to understand the crash situation
  • adnako
    adnako over 3 years
    Crashlytics.crashlytics().log("TEST")
  • SKREFI
    SKREFI over 3 years
    But can I use something from firebase to simply log some basic string? When I write: Log.d("Potatoes") or Timber.d("More Potatoes") Can I see some "potatoes" ANYWHERE in my Firebase Console? I only found a workarround to log an Exception which then is sent to the Firebase with my custom message, but it's not really the optimal way I guess, more of a hack.