Add structured, auto-tagged logging to an Android app without writing or managing tag strings anywhere in the codebase.
Route production crash logs to a reporting service like Firebase Crashlytics by writing a custom Tree alongside the debug logger.
Catch logging mistakes at compile time, mismatched format string arguments or raw Log calls, using Timber's built-in lint rules.
Timber is a logging library for Android apps, written by Jake Wharton, a well-known Android developer. Android has a built-in logging system called Log, and Timber is a thin wrapper around it that adds a few practical improvements. The main convenience Timber offers is automatic tagging. When you write a log statement in Android code, you normally have to supply a tag string identifying where the log came from, and managing these tags manually across a large codebase is tedious. Timber figures out the calling class name automatically and uses it as the tag, so you can write log calls without thinking about that detail. The library is built around a concept called Trees. A Tree is an object that decides what to do with each log message. You install one or more Trees when your app starts up. The default one included, called DebugTree, prints to Android's standard log output. If you wanted logs to also go to a crash reporting service in production, you would write a custom Tree that sends them there and install both Trees at startup. Logging calls anywhere in your app then reach all installed Trees automatically. Timber also ships with built-in lint rules, which are static analysis checks that run while you compile. They catch common mistakes such as passing the wrong number of arguments for a format string, using log tags that are too long for Android's limit, calling Android's raw Log class directly instead of Timber, or wrapping log messages with String.format when Timber already handles formatting. It is installed as a standard Android library dependency through Maven Central. The library is licensed under the Apache License 2.0.
← jakewharton on gitmyhub — every repo by this author, as a profile.
Verify against the repo before relying on details.