react-native

How to get crash logs for React Native app?


My React Native App crashed on a tester's phone.

What is the best way to get logs of that crash? I'm using React Native 0.14.2


Solution

  • As @Abhishek has commented, you'll have to use some monitoring tools with crashlytics to get such infomation.

    Fabric is a good option in this case. It comes with a crashlytics solution.

    Here is a blogpost that explains in-depth on how to set it up for your app.

    Here's an excerpt of features of crashlytics tool of Fabric from the blogpost

    Crash Reporting —It will record every single crash and its stack trace. This is way better than the iTunes Connect crash reports, which only include the info of users that opted in to share information with developers while setting up a new iPhone. It’s also not updated in real-time (you can read more about this here).

    Crash Logs — (A.K.A. CLS_LOG) If you’re familiar with Objective-C, you have probably been using “NSLog” while you’re developing your app. You should use CLS_LOG instead. There’s no difference at all when you’re debugging (whatever you’re logging will still show up in the console) but the cool part is that when a user crashes your app, all the information will be sent to Crashlytics’s servers the next time the user launches your app, including all the content that you’ve logged through CLS_LOG. So if you log information for most of the actions/events in your app, you can read the logs later and reproducing the crash should be simple.