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");
}
}
OR Maven users can simply add these dependencies to pom.xml:
<dependency>
<groupId>com.github.tony19</groupId>
<artifactId>logback-android-core</artifactId>
<version>1.0.10-2</version>
</dependency>
<dependency>
<groupId>com.github.tony19</groupId>
<artifactId>logback-android-classic</artifactId>
<version>1.0.10-2</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.5</version>
</dependency>