SLF4J binding for Jake Wharton's Timber Android logging library
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.buildscript
gradle Migrate to Gradle build system, Timber 4.4.0, SLF4J 1.7.21 Dec 11, 2016
slf4j-timber Migrate to Gradle build system, Timber 4.4.0, SLF4J 1.7.21 Dec 11, 2016
.gitignore Migrate to Gradle build system, Timber 4.4.0, SLF4J 1.7.21 Dec 11, 2016
.travis.yml Migrate to Gradle build system, Timber 4.4.0, SLF4J 1.7.21 Dec 11, 2016
CHANGELOG.md Prepare for release 3.0. Dec 11, 2016
LICENSE.txt
README.md
RELEASING.md
build.gradle Migrate to Gradle build system, Timber 4.4.0, SLF4J 1.7.21 Dec 11, 2016
checkstyle.xml
gradle.properties
gradlew
gradlew.bat
settings.gradle

README.md

slf4j-timber

Build Status Maven Central Apache License Android Arsenal

SLF4J binding for Jake Wharton's Timber Android logging library

Usage

Just put slf4j-timber, timber and slf4j-api (see note in Download) artifacts to your project and use slf4j like before:

public class YourClass {
  private static final Logger logger = LoggerFactory.getLogger(YourClass.class);

  public void yourMethod() {
    logger.debug("Hello, world!");
  }
}

Don't forget to plant tree to Timber, check Timber usage.

Download

Download the latest JAR or grab via Maven:

<dependency>
  <groupId>com.arcao</groupId>
  <artifactId>slf4j-timber</artifactId>
  <version>3.0</version>
  <type>aar</type>
</dependency>

or Gradle:

implementation 'com.arcao:slf4j-timber:3.0@aar'

Note: timber and slf4j-api are the transitive dependencies of slf4j-timber, so you don't need to take care of them in Maven POM and Gradle build script.

Transitive dependencies by version

slf4j-timber Timber SLF4J
3.0 4.4.0 1.7.21
2.1 3.1.0 1.7.12
2.0 3.0.1 1.7.12
1.6 2.7.1 1.7.12
1.5 2.5.1 1.7.7
1.4 2.4.1 1.7.7
1.3 2.2.2 1.7.7

Binding log4j, Jakarta Commons Logging or java.util.logging over Timber

SLF4J project already contains wrappers for log4j, Jakarta Commons Logging (JCL) and java.util.logging (JUL). You have to include log4j-over-slf4j, jcl-over-slf4j or jul-to-slf4j jar file to your project. These jar files are distributed in SLF4J package.

For Maven and Gradle users it is only about adding new dependency in POM / build script. Below follows the example for log4j, for other bindings it is similar:

Maven:

<dependency>
  <groupId>org.slf4j</groupId>
  <artifactId>log4j-over-slf4j</artifactId>
  <version>1.7.21</version>
</dependency>
<dependency>
  <groupId>com.arcao</groupId>
  <artifactId>slf4j-timber</artifactId>
  <version>3.0</version>
</dependency>

or Gradle:

compile 'org.slf4j:log4j-over-slf4j:1.7.21'
compile 'com.arcao:slf4j-timber:3.0'

Don't forget to exclude log4j transitive dependency from artifact which use log4j, otherwise you can get to trouble with the duplicate classes in Android build system:

Maven:

<dependency>
  <groupId>library</groupId>
  <artifactId>library-using-log4j</artifactId>
  <version>1.0</version>
  <exclusions>
    <!-- excluded, log4j-over-slf4j used instead -->
    <exclusion>
      <groupId>log4j</groupId>
      <artifactId>log4j</artifactId>
    </exclusion>
  </exclusions> 
</dependency>

or Gradle:

compile('library:library-using-log4j:1.0') {
  exclude group: 'log4j', module: 'log4j' /* excluded, log4j-over-slf4j used instead */
}

License

Copyright 2014 Martin Sloup

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.