Integrate slf4j with Crashlytics
As I mentioned in my previous post having meaningful log entries comes handy during development. When an app reaches beta testers as well as goes live it’s equally or even more important to be able to figure out why the app you’ve carefully coded isn’t behaving as it should. Testing the app on all android flavours is literally impossible that’s why getting an insight into what caused a crash is vital.
Error reporting providers are getting more and more popular. There are plenty of options to choose from: Raygun, Airbrake and Crashlytics are just frew examples. At Bright Inventions we use the last one and are more and more pleased with it. Setting it up is really easy - if you don’t mind installing an IDE plugin it provides. Frankly I would prefer being able to configure a project with a simple command line tool but I understand a motivation behind it which is making the installation as seamless as possible.
Crashlytics let’s you not only report uncaught exceptions but also handled errors with additional information provided by log entries:
This will print messages to logcat as well as well as well as make them available in Crashlytics dashboard.
Using slf4j with Crashlytics
All that is left is to add the handler to root logger in your custom application
From now on all log messages will go through Crashlytics API and couple of last log entries will be available next to crash report details in dashboard.
This article is cross-posted with my personal blog