public enum Slf4jExceptionHandler extends Enum<Slf4jExceptionHandler> implements ExceptionHandler
Each enum constant represents a logging level and calls the matching
method on the SLF4J Logger. When SLF4J fails to initialise, or
the logger throws at runtime, the implementation writes to
System.err instead.
| Modifier and Type | Method and Description |
|---|---|
void |
on(@NotNull Class<?> clazz,
@Nullable String message,
@Nullable Throwable thrown)
Handles an exception for the given class, message and throwable.
|
void |
on(@NotNull org.slf4j.Logger logger,
@Nullable String message,
@Nullable Throwable thrown)
Handles an exception with the given logger, message and throwable.
|
static Slf4jExceptionHandler |
valueOf(LogLevel logLevel)
Returns the appropriate Slf4jExceptionHandler value based on the given LogLevel.
|
static Slf4jExceptionHandler |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static Slf4jExceptionHandler[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOfdefaultHandler, ignoresEverything, isEnabled, on, on, onpublic static final Slf4jExceptionHandler ERROR
public static final Slf4jExceptionHandler WARN
public static final Slf4jExceptionHandler PERF
public static final Slf4jExceptionHandler DEBUG
public static Slf4jExceptionHandler[] values()
for (Slf4jExceptionHandler c : Slf4jExceptionHandler.values()) System.out.println(c);
public static Slf4jExceptionHandler valueOf(String name)
name - the name of the enum constant to be returned.IllegalArgumentException - if this enum type has no constant with the specified nameNullPointerException - if the argument is nullpublic void on(@NotNull
@NotNull org.slf4j.Logger logger,
@Nullable
@Nullable String message,
@Nullable
@Nullable Throwable thrown)
ExceptionHandleron in interface ExceptionHandlerlogger - the logger used to record the errormessage - a custom message detailing the error, may be nullthrown - the throwable instance representing the error, may be nullpublic void on(@NotNull
@NotNull Class<?> clazz,
@Nullable
@Nullable String message,
@Nullable
@Nullable Throwable thrown)
ExceptionHandlerERROR level.on in interface ExceptionHandlerclazz - the class where the exception occurredmessage - a custom message providing additional information or nullthrown - the exception that needs to be handled, may be nullpublic static Slf4jExceptionHandler valueOf(LogLevel logLevel)
logLevel - the LogLevel enum to convert.Copyright © 2026 Chronicle Software Ltd. All rights reserved.