Reporting logcat output to Firebase upon crash - android

I'm looking to improve and get better insights into the apps behaviour right before a crash. In the production we have a lot of Timber.d and Log.XX calls issued but it is not possible to currently see the full application's log-stack in Firebase Crashlytics section. We only see the stacktrace of the crash as well as all the custom Firebase events that have been called.
Can someone advise on any feasible methods of forcing the application to submit the full log-stack upon a crash such that it would also be visible in Firebase?

There is no way to post full log files to Crashlytics.
What you can do:
Log events with Analytics at key points in your app's flow, which will then also show up (as a sort of breadcrumb) in your Crashlytics views by adding custom keys.
Write custom log messages for key points in your code leading up to the crash.
Set a user ID for your app instance, and then write the log file to another cloud based storage location (like Cloud Storage, for which there's also a Firebase SDK) with that same user id, after the app is restarted.

Related

Monitor android application for user debug

I wish to monitor app behavior and debug application on different devices.
I am trying to select the best approach, Firebase analytics, crashlitics, Goole analytics etc...
The problem:
User report on some devices they see incorrect app behavior (Not crash). For example user reports button not working, I wish to check if the user actually clicked the button and what happened.
What I need:
I need to find that specific user (or phone) in the monitoring system mentioned above and check the logs I added (for example: firebaseAnalytics.logEvent...)
Solution questions
Can I find specific user or phone in firebaseAnalytics? What is the best approach to addressing my requirements?
You can use Firebase Analytics Event Logging & Set User Id.
With this feature, you can keep track of users' logs, later generate statistics in Firebase Analytics or Google Analytics, and track specific users if you wish.
check this links
Firebase Analytics Set User Id
Firebase Analytics Event Logging
And If you want check not you wanted situation, you can add a custom exception to firebase.
try like this code.
if(isExpectedSituation) {
// some your codes.
} else {
FirebaseCrashlytics.getInstance().recordException(YourCustomException());
}

Where does Crashlytics.log(""); go?

I'm trying to set up my app with firebase+crashlytics for having a better error dashboard.
All the firebase stuff is already working and I'm able to access the features
I tested crashlytics with:
Crashlytics.getInstance().crash(); // Force a crash
and i'm able to see the stack trace on my dashboard (inside firebase)
but I'm trying to log non-fatal messages like:
Crashlytics.log("test");
And it doesn't appear anywhere
I followed the whole instructions at:
https://firebase.google.com/docs/crashlytics/customize-crash-reports
Still doesn't find any dashboard with the "test" messages
Where does it go? what am I missing?
Sending non-debug errors (e.g. your test message) logs to Crashlytics locally, but these exceptions are not uploaded until the app restarts.
As the documentation states:
Crashlytics batches logged exceptions together and sends them the next time the app launches.
This is presumably due to the primary Crashlytics functionality (reporting crashes) working in the same way, and non-fatal errors being a secondary concern using the same code flow.
Whilst this is unfortunate, there are many third party log-collating services that can handle the non-fatal errors.
Note: I'm aware you've received an answer in the comments from Crashlytics, I'm providing a more comprehensive answer for future visitors.
It's an old question any way i wanted to share what happens to messages logged using Crashlytics.log(msg); These logs are not immediately shown to dashboard. Crashlytics stores all the logged messages logged using log(msg) method and uploads it to server when a new Crash or Exception occurs.
You can see these messages in Firebase console under logs section as shown in below image
One more thing if you want to log exceptions there is another method for it Crashlytics.logException(exception)
Crashlytics isn't made for develop logging/debug, it is made to cluster hundreds/thousands of logs from different users at runtime, this may cause delays between the time the log message are recorded and when you will really be able to see them at the dashboard making it unusable for development debug.
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.
https://stackoverflow.com/a/69340289/5679560
As mentioned in below link
https://support.crashlytics.com/knowledgebase/articles/120066-how-do-i-use-logging
You can see this crashes on Crashlytics dashboard if you look at the specific crash itself.
The recommended way to add custom logging to your app is:
Crashlytics.log(int priority, String tag, String msg)

How to get a log file from end user device in Android?

I need to get logs which is stored as a log file in end user device, for getting that I can implement send feedback option and make user send the file to a email address given in intent.
But I need something better than this like google analytics or some other logging stuff which is easy to use where we can upload a file, and still manage other log events too.
You can use Firebase, it's have many feature to use.
Report Crashes on Android
Firebase Crash Reporting creates detailed reports of the errors in your app. Errors are grouped into issues based on having similar stack traces, and triaged by the severity of impact on your users. In addition to receiving automatic reports, you can log custom events to help capture the steps leading up to a crash.
You can watch docs in here: https://firebase.google.com/docs/crash/android

What is the best way to set a Firebase Crash user identifier in a widget?

I have been using Crashlytics quite a lot, but now I'm trying out Firebase Crash in an app.
I would like to set some kind of user identifier to be able to cross check reports sent by users themselves and crash reports.
In Crashlytics I have always used Crashlytics.setUserIdentifier() (https://docs.fabric.io/android/crashlytics/enhanced-reports.html?identifier#user-information ).
As far as I can see I have to use FirebaseCrash.log() (https://firebase.google.com/docs/crash/android#create_custom_logs ), but that won't set the identifier one time, right? I suppose it will log it every time I call that method.
That leads me to the real question. The app is a widget with a service that runs relatively often without the user needing to access an activity. What will be the best place to do that logging?
Using Crashlytics I have set the user identifier either in the main activity or in a class extending Application. Doing the last of the two with Firebase Crash seems to trigger a known issue.
Currently there is no way to uniquely identify a user in a crash report. We are considering ways to be able to do this without compromising the privacy of the individual user, which is very important to us.

Android application bug report

Any ideas how can I create a bug report in my application and when application crash to open a dialog and give the user a chance to send us report with files attached to the e-mail and etc. I've already implemented a function which is sending the error message to out server, but I want to be able to let the user to send these errors with some text input, attached files and etc.
Any ideas how should I proceed?
You can find exactly what you're looking for in Instabug. It is a bug & crash reporting SDK that allows for two things:
Allows users to report bugs through a shake gesture in-app
Upon a shake, a screenshot is taken that the user can draw on for visual bug identification.
User can further describe the bug using text, extra screenshots, voice notes, or even screen recordings.
Automatically receive crash reports in the event of a crash
All reports arrive to your Instabug dashboard containing various details such as:
Network and console logs
Complete Device details
Visual reproduction steps
Crash stack trace (In case of a crash report)
It only takes a line of code to integrate.
For full disclosure, I work at Instabug. Let me know if I can help.
See ACRA. It's a solid crash reporting library.
You can get more information than the reports in Google Play, and there are a lot of configuration options detailing just which info you want and how you want it delivered. Default is to upload spreadsheets into Google docs.
Also allows user input at crash time.

Categories

Resources