What is it?

logback-android is a lite version of logback that runs on Android. logback is the successor to the classic log4j project, designed by the same author, and is one of the most widely used logging frameworks on the JVM. logback-android adapts that engine for Android: it removes server-oriented components that don't make sense on a phone (Groovy config, JMX, servlet integration) and adds Android-specific ones, like the LogcatAppender and runtime variables for app data directories.

Your application code never talks to logback-android directly. Instead, it logs through SLF4J, the standard Java logging facade. logback-android plugs in underneath as the implementation, which means libraries written against SLF4J — the vast majority of Java logging code — work on Android without modification.

Design goals

A short history

The project was started in 2011 by Anthony Trinh (@tony19) as a port of logback to Android, and has been maintained continuously since. The 1.x series tracked logback 1.1; the 2.x series moved to logback 1.2 with AndroidX-era tooling; and the current 3.x series modernizes the toolchain with JDK-specific artifacts:

ArtifactBytecodeminSdk
com.github.tony19:logback-androidJava 1126 (Android 8.0)
com.github.tony19:logback-android-jdk8Java 821 (Android 5.0)

Use logback-android unless your app must support devices older than Android 8.0, in which case use logback-android-jdk8. For the legacy 1.x line, see the 1.x branch.

How the pieces fit

┌─────────────────────────────┐
│    Your app & libraries     │
│   log.info("hello world")   │
└──────────────┬──────────────┘
               │  SLF4J API (facade)
┌──────────────▼──────────────┐
│       logback-android       │
│  levels · filters · layout  │
└──┬─────┬─────┬─────┬─────┬──┘
   │     │     │     │     │
logcat  file SQLite socket syslog/email

License & contributing

logback-android is free software released under the Apache License 2.0. Bug reports, feature requests, and pull requests are welcome on the GitHub repository.