Android Crashlytics not logging non-fatals
Asked Answered
H

2

8

I'm logging crashlytics errors in fabric. It works for crashes, and auto-generated non-fatals. But when I try to manually log non-fatals, it doesnt show at all. What can be the problem? (Yes, I have re-opened the app after the logging).

The logging methods I have tried:

Crashlytics.log(message);

Crashlytics.getInstance().core.logException(exception); //Caught exception

Crashlytics.logException(exception); //Caught exception

Crashlytics.logException(new Throwable(message));

None of them show up in my fabric dashboard...

I instantiate Fabric with this and its logging crashes, so I don't think that's the problem.

Fabric.with(this, new Crashlytics());
Hurtle answered 2/10, 2017 at 8:9 Comment(14)
Crashlytics.logException(exception) should do it. Usually there is a limit to number of non fatals that it records. Is none of them showing? For any individual app session, only the most recent 8 logged exceptions are stored. docs.fabric.io/android/crashlytics/caught-exceptions.htmlCrat
None are logged. Absolutely none. Not one. We have 70k daily users, so its definitively not working.Hurtle
I see. And as you've shown in the question, you've tried forcing a non-fatal crash. And I assume your filter is of last 90 days? Which version of the SDK are you using?Crat
Forced crash: Yes Filter: Yes SDK version: classpath 'io.fabric.tools:gradle:1.22.1'Hurtle
I have set to 1.23.0 and it works fine. Try updating it and maybe make sure you have ext.enableCrashlytics = true. Or atleast not set to false in build.gradle. Else open a bug report to them probably.Crat
Thanks for the help. Will try the changes you prepose. :)Hurtle
BTW: How do you instantiate Crashlytics in your app?Hurtle
Mike from Fabric here. Can you share your app's package name?Enter
Hey Mike! Its 'com.norwegian.travelassistant', could you contact me on mail: travelassistantATnorwegian.com ?Hurtle
@MikeBonnell Did you check it?Hurtle
Sorry, I missed your ping back! I'll follow up over email.Enter
I dont know why, but it suddenly worked. Thanks to @MikeBonnell for reaching out to help. :)Hurtle
@Hurtle can you please share how you are able to see the logs in your Crashlytics dashboard ?Crinite
@Crinite I did not do anything specific, it just worked after some time.Hurtle
F
2

Try this, it's working code from my projects.

try {
    //your codes                    
} catch (Exception ex) {
    ex.printStackTrace();
    Crashlytics.log("log something");//Optional
    Crashlytics.setString("message", message);//Optional
    Crashlytics.logException(ex);

}
Foozle answered 2/10, 2017 at 8:18 Comment(2)
As said in the question, this is what I have tried. Dont know why its failing, but cant see any instances of non-fatals at all.Hurtle
@Hurtle did you tried using .log() or .setString() before Crashlytics.logException(ex);Swain
D
5

In Crashlytics BETA in firebase console 'Crashes only' events displayed by default. If you want view non-fatal events you must select 'All events' or 'Non-fatals only'.

Maybe it can help in Fabric console.

P.S. I don't worked with fabric without firebase.

Doane answered 3/11, 2017 at 12:2 Comment(0)
F
2

Try this, it's working code from my projects.

try {
    //your codes                    
} catch (Exception ex) {
    ex.printStackTrace();
    Crashlytics.log("log something");//Optional
    Crashlytics.setString("message", message);//Optional
    Crashlytics.logException(ex);

}
Foozle answered 2/10, 2017 at 8:18 Comment(2)
As said in the question, this is what I have tried. Dont know why its failing, but cant see any instances of non-fatals at all.Hurtle
@Hurtle did you tried using .log() or .setString() before Crashlytics.logException(ex);Swain

© 2022 - 2024 — McMap. All rights reserved.