How to Implement Better Logging With Timber?

How to Implement Better Logging With Timber?

Timber is a well known logging platform for Android development that is popular for its lightweight and extensible API that works with Android’s native logging system. Timber can work side by side with Bugfender, especially in cases where apps do not log to logcat when compiled. Details and instructions for implementation are given here. You can add Timber in any existing Android project with a little work.

First you need to add Timber initialization code; by planting a “debug tree” you set the type of logger you want to use. The same debug tree provides all the basic features you might want to use in Android development. Now the platform has been initialized, you can see it has the same logging methods available in Android dialogue framework.

However there is a small difference here; in Android dialogue framework the Exception is passed as a last parameter but in Timber you need to provide the exception as first parameter. Interestingly, in Timber you don’t have to provide a tag in logging calls because Timber automatically does that. Timber uses the file name where you are logging from as tag. You can see the detailed information in this video:

Bugfender and Timber combined together, provide amazing centralized logging that has tons of benefits:

  • In case of centralized logs, all of the data is stored in a single location that only makes it easier for developers and testers to retrieve required logs using a single interface but also avoid the troublesome process of retrieving the information from multiple different systems.
  • The platform that handles logging process as well as the centralized log management system, automatically handles different types of logs. As logs come in several different formats, the platform automatically converts them to a standard format to increase the productivity and readability.
  • Centralized logging systems come with many advanced features like searching, indexing and others. The platform processes the log data and breaks it down to its key components. Developers can search and filter specific logs based on their key components.
  • Log data could be exported or redistributed when needed without changing or opening the original log file.

Android uses the pre-configured logging API that supports many popular logging tools like Timber. This built-in API collects log data to Logcat that stores that data in a file. By utilizing a cloud based logging framework like Bugfender, developers and testers can get rid of the intermediary process and directly access the log data via web interface.

What Are 1000 Apps Doing to Reduce Their Bugs to Zero?

Down to Zero is a practical guide to solving bugs. Our team has been developing mobile apps for over a decade and we'd like to share some tips we've picked up along the way.

Get the Ebook for Free

Down to Zero Ebook

Bugfender offers developers and testers a comprehensive testing platform where they can get rid of their dependency on emulators and test apps on real devices in real life situations. In our previous post we discussed some app testing challenges and how factors like network and geographical location of the devices affect app behavior. It is impossible to reproduce every bug in lab that means developers can only get detailed information about bugs from users. Bugfender terminates this dependency too.

Getting physical access to a particular device where the app is not working properly could be impossible if it is located half way around the world. That’s where remote logging tool Bugfender excels; the platform allows developers to access logs generated by specific devices and analyze those logs to discover and fix bugs. The main concept behind Bugfender is to find bugs before users see them. Other than remote logging platform, there are two other approaches that developers usually use; using real devices and using emulators.

Using real devices is an expensive approach and it is getting harder and harder for both iOS and Android as there are hundreds of different device models and operating system variants available. Emulators solve this issue but they do not mimic the real device and real life scenarios. Bugfender accumulates factors like bugs caused by network, battery, other apps and virtually everything else as it generated detailed logs.

as_ford Created with Sketch. as_aimail Created with Sketch. as_slack Created with Sketch. as_tesco Created with Sketch. as_disney Created with Sketch. as_cantina Created with Sketch. as_vorwerk Created with Sketch.

Already Trusted by Thousands

Bugfender is the best remote logger for mobile apps.

Get Started for Free, No Credit Card Required