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.Runnable
that swallows all runtime exceptions and logs them to SLF4J.VerboseProcess
: wrapper aroundjava.lang.Process
that monitors process executions, collects its output into aString
and logs everything through SLF4J.VerboseThreads
: an implementation ofjava.util.concurrent.ThreadFactory
that instantiates threads that log all runtime exceptions through SLF4J.
The only dependency you need is (you can also download jcabi-log-0.24.2.jar
and add it to the classpath):
<dependency> <groupId>com.jcabi</groupId> <artifactId>jcabi-log</artifactId> <version>0.24.2</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>