How to Implement Better Logging With Timber

How to Implement Better Logging With Timber

AndroidDebuggingQ/A
Fix bugs faster! Log Collection Made Easy
START NOW!

Timber is one of the best-known logging platforms for Android development, revered by developers for a lightweight and scalable API that dovetails with Android’s native logging system.

We’re happy to say that our own logging product, Bugfender, works in tandem with Timber, especially in cases where apps do not go to logcat when compiled. You can find all the details you need about implementation here.

But, before we talk about the benefits of Bugfender integration in more detail, we’d like to tell you a little bit about Timber, and how you can get started.

To kick things off, you need to add the Timber initialization code. By planting a “debug tree” you set the type of logger you want to use. This same debug tree provides all the basic features you might want to use in Android development. 

Once you’ve initialized the platform, you’ll see it has the same logging methods available in the main Android dialogue framework. However there’s a small difference; in the Android dialogue framework the exception is passed as a last parameter. In Timber, however, this exception must be passed first-off, straight off the bat.

Interestingly, in Timber you don’t have to provide a tag in logging calls because Timber automatically does that. Timber uses the filename you are logging from as a tag in itself. You can see the detailed information in this video:

Ok, now we’re going to talk a bit more about Bugfender and how it works with Timber. When used in harmony, the two applications provide truly panoramic, centralized logging, with a whole stack of benefits.

Here are some of the real stand-outs from our perspective:

  • In the case of centralized logs, all data is stored in a single location, which makes it easier for developers and testers to retrieve required logs using a single interface, while avoiding the troublesome process of retrieving the information from multiple different systems.
  • The platform that handles logging processes, 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, increasing both productivity and readability.
  • Centralized logging systems come with many advanced features, such as searching and indexing. 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 a pre-configured logging API which supports many popular logging tools, including Timber. This built-in API collects log data to Logcat, which then 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 wean themselves off 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 devices affect app behavior. It is impossible to reproduce every bug in a lab, which means developers can only get detailed information about bugs from the users themselves. Bugfender removes this dependency, too.

When an app is not working properly, it might be impossible to obtain physical access if the user is located halfway round the world. That’s where Bugfender, as a remote logging tool, 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. Developers can also use real devices, and emulators, for this purpose, but we feel a remote logger has the edge on both methods.

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. Then there’s the fact that users are spread all around the world, which can make it impossible to contact them. Emulators solve this issue to an extent, but they do not mimic the real device and real life scenarios.

Bugfender, in contrast, allows you to recreate any bug on any device, anywhere in the world – without bothering your user base. It accumulates factors like bugs caused by network, battery, other apps and virtually everything else as it generated detailed logs.

July 2019: we’ve updated this article to reflect the latest news and trends around this topic. It’s one of the most popular articles on our site and we hope you continue to find it useful!

Expect the Unexpected! Debug Faster with Bugfender
START FOR FREE

Trusted By

/assets/images/svg/customers/projects/porsche.svg/assets/images/svg/customers/cool/riachuelo.svg/assets/images/svg/customers/highprofile/macys.svg/assets/images/svg/customers/highprofile/adt.svg/assets/images/svg/customers/cool/starbucks.svg/assets/images/svg/customers/projects/eye-d.svg/assets/images/svg/customers/highprofile/tesco.svg/assets/images/svg/customers/highprofile/intel.svg

Already Trusted by Thousands

Bugfender is the best remote logger for mobile and web apps.

Get Started for Free, No Credit Card Required