Fork me on GitHub

logback-android

The reliable, generic, fast and flexible logging framework for Java on Android.

Quick Start

  1. Add logback-android and slf4j-api to your project classpath.
  2. Configure logback-android using an XML file or in-code statements. Otherwise, logging is silently disabled.
  3. Use slf4j-api in your application to write logging statements as shown in the example below.

    package com.example;
    
    import org.slf4j.Logger;
    import org.slf4j.LoggerFactory;
    
    import android.os.Bundle;
    import android.app.Activity;
    
    public class MainActivity extends Activity {
      @Override
      protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    
        // SLF4J
        Logger LOG = LoggerFactory.getLogger(MainActivity.class);
        LOG.info("hello world");
      }
    }
    

Documentation

Download

OR add a Gradle dependency:

dependencies {
  compile 'org.slf4j:slf4j-api:1.7.25'
  compile 'com.github.tony19:logback-android:1.1.1-12'
}

License

EPL v1.0 or (per the licensee's choosing) LGPL v2.1