About logback-android
+Where the project came from, what it aims to be, and how the pieces fit together.
+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
+-
+
- Fidelity to logback. Configuration files, pattern layouts, filters, and + appender concepts behave the way the logback manual + describes them, so existing knowledge transfers directly. +
- Configurability without code. Logging behavior lives in
+
logback.xml, not scattered through your source. Change destinations, levels, + and formats without recompiling.
+ - Android awareness. Built-in properties such as
${DATA_DIR}, +${LOG_DIR},${EXT_DIR},${PACKAGE_NAME}, +${VERSION_NAME}, and${VERSION_CODE}resolve at runtime, so one + config works across devices and app versions.
+ - Small footprint. Only what an Android app needs, keeping method count + and APK size down. +
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: +
+| Artifact | Bytecode | minSdk |
|---|---|---|
com.github.tony19:logback-android | Java 11 | 26 (Android 8.0) |
com.github.tony19:logback-android-jdk8 | Java 8 | 21 (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. +
+