SLF4J extension for NoException

NoException » Extensions » SLF4J

This extension of NoException library adds exception handlers that log all exceptions to SLF4J loggers.

Download

Get this extension from Maven Central:

Tool
<dependency>
    <groupId>com.machinezoo.noexception</groupId>
    <artifactId>noexception-slf4j</artifactId>
    <version>1.0.2</version>
</dependency>

Or clone sources from GitHub or Bitbucket. Don't forget to configure your build for Java 11+. Sources and binaries are distributed under Apache License 2.0.

If your project is a Java module, add the following declaration to your module-info.java:

requires com.machinezoo.noexception.slf4j;

Handlers

Class ExceptionLogging provides the following exception handlers:

Usage

Typical usage is to catch all exceptions and log them:

System.out.println(
    ExceptionLogging.log().get(() -> "test".substring(5)).orElse("fallback"));

See NoException tutorial for other ways to use the handlers.

Next steps