Static Wrapper of SLF4J
Logger is a convenient static wrapper of slf4j (don't forget to include one of SLF4J Bindings into the project):
import com.jcabi.log.Logger;
class Foo {
void bar(int value) {
Logger.debug(this, "method #bar(d) was called", value);
}
}Read also about log decors and a convenient AOP annotation @Loggable from jcabi-aspects.
There are a few other convenient classes in this package:
VerboseRunnable: wrapper aroundjava.lang.Runnablethat swallows all runtime exceptions and logs them to SLF4J.VerboseProcess: wrapper aroundjava.lang.Processthat monitors process executions, collects its output into aStringand logs everything through SLF4J.VerboseThreads: an implementation ofjava.util.concurrent.ThreadFactorythat instantiates threads that log all runtime exceptions through SLF4J.
The only dependency you need is (you can also download jcabi-log-0.24.3.jar and add it to the classpath):
<dependency> <groupId>com.jcabi</groupId> <artifactId>jcabi-log</artifactId> <version>0.24.3</version> </dependency>
Cutting Edge Version
If you want to use current version of the product, you can do it with this configuration in your pom.xml:
<repositories>
<repository>
<id>oss.sonatype.org</id>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.jcabi</groupId>
<artifactId>jcabi-log</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>