public class Logger
extends java.lang.Object
Logger.info("Hello!");Example, logging with a custom logger:
Logger.of("my.logger").info("Hello!")Each of the logging methods is overloaded to be able to take an array of arguments. These are formatted into the message String, replacing occurrences of '{}'. For example:
Logger.info("A {} request was received at {}", request.method(), request.uri());This might print out:
A POST request was received at /api/itemsThis saves on the cost of String construction when logging is turned off. This API is intended as a simple logging API to meet 99% percent of the most common logging needs with minimal code overhead. For more complex needs, the underlying() methods may be used to get the underlying SLF4J logger, or SLF4J may be used directly.
Modifier and Type | Class and Description |
---|---|
static class |
Logger.ALogger
Typical logger interface
|
Constructor and Description |
---|
Logger() |
Modifier and Type | Method and Description |
---|---|
static void |
debug(java.lang.String message)
Deprecated.
Deprecated as of 2.7.0. Create an instance of
Logger.ALogger via of(String) / of(Class) and use the same-named method. Or use SLF4J directly. |
static void |
debug(java.lang.String message,
java.lang.Object... args)
Deprecated.
Deprecated as of 2.7.0. Create an instance of
Logger.ALogger via of(String) / of(Class) and use the same-named method. Or use SLF4J directly. |
static void |
debug(java.lang.String message,
java.util.function.Supplier<?>... args)
Deprecated.
Deprecated as of 2.7.0. Create an instance of
Logger.ALogger via of(String) / of(Class) and use the same-named method. Or use SLF4J directly. |
static void |
debug(java.lang.String message,
java.lang.Throwable error)
Deprecated.
Deprecated as of 2.7.0. Create an instance of
Logger.ALogger via of(String) / of(Class) and use the same-named method. Or use SLF4J directly. |
static void |
debug(java.util.function.Supplier<java.lang.String> msgSupplier)
Deprecated.
Deprecated as of 2.7.0. Create an instance of
Logger.ALogger via of(String) / of(Class) and use the same-named method. Or use SLF4J directly. |
static void |
error(java.lang.String message)
Deprecated.
Deprecated as of 2.7.0. Create an instance of
Logger.ALogger via of(String) / of(Class) and use the same-named method. Or use SLF4J directly. |
static void |
error(java.lang.String message,
java.lang.Object... args)
Deprecated.
Deprecated as of 2.7.0. Create an instance of
Logger.ALogger via of(String) / of(Class) and use the same-named method. Or use SLF4J directly. |
static void |
error(java.lang.String message,
java.util.function.Supplier<?> args)
Deprecated.
Deprecated as of 2.7.0. Create an instance of
Logger.ALogger via of(String) / of(Class) and use the same-named method. Or use SLF4J directly. |
static void |
error(java.lang.String message,
java.lang.Throwable error)
Deprecated.
Deprecated as of 2.7.0. Create an instance of
Logger.ALogger via of(String) / of(Class) and use the same-named method. Or use SLF4J directly. |
static void |
error(java.util.function.Supplier<java.lang.String> msgSupplier)
Deprecated.
Deprecated as of 2.7.0. Create an instance of
Logger.ALogger via of(String) / of(Class) and use the same-named method. Or use SLF4J directly. |
static void |
info(java.lang.String message)
Deprecated.
Deprecated as of 2.7.0. Create an instance of
Logger.ALogger via of(String) / of(Class) and use the same-named method. Or use SLF4J directly. |
static void |
info(java.lang.String message,
java.lang.Object... args)
Deprecated.
Deprecated as of 2.7.0. Create an instance of
Logger.ALogger via of(String) / of(Class) and use the same-named method. Or use SLF4J directly. |
static void |
info(java.lang.String message,
java.util.function.Supplier<?>... args)
Deprecated.
Deprecated as of 2.7.0. Create an instance of
Logger.ALogger via of(String) / of(Class) and use the same-named method. Or use SLF4J directly. |
static void |
info(java.lang.String message,
java.lang.Throwable error)
Deprecated.
Deprecated as of 2.7.0. Create an instance of
Logger.ALogger via of(String) / of(Class) and use the same-named method. Or use SLF4J directly. |
static void |
info(java.util.function.Supplier<java.lang.String> msgSupplier)
Deprecated.
Deprecated as of 2.7.0. Create an instance of
Logger.ALogger via of(String) / of(Class) and use the same-named method. Or use SLF4J directly. |
static boolean |
isDebugEnabled()
Deprecated.
Deprecated as of 2.7.0. Create an instance of
Logger.ALogger via of(String) / of(Class) and use the same-named method. Or use SLF4J directly. |
static boolean |
isErrorEnabled()
Deprecated.
Deprecated as of 2.7.0. Create an instance of
Logger.ALogger via of(String) / of(Class) and use the same-named method. Or use SLF4J directly. |
static boolean |
isInfoEnabled()
Deprecated.
Deprecated as of 2.7.0. Create an instance of
Logger.ALogger via of(String) / of(Class) and use the same-named method. Or use SLF4J directly. |
static boolean |
isTraceEnabled()
Deprecated.
Deprecated as of 2.7.0. Create an instance of
Logger.ALogger via of(String) / of(Class) and use the same-named method. Or use SLF4J directly. |
static boolean |
isWarnEnabled()
Deprecated.
Deprecated as of 2.7.0. Create an instance of
Logger.ALogger via of(String) / of(Class) and use the same-named method. Or use SLF4J directly. |
static Logger.ALogger |
of(java.lang.Class<?> clazz)
Obtain a logger instance.
|
static Logger.ALogger |
of(java.lang.String name)
Obtain a logger instance.
|
static void |
trace(java.lang.String message)
Deprecated.
Deprecated as of 2.7.0. Create an instance of
Logger.ALogger via of(String) / of(Class) and use the same-named method. Or use SLF4J directly. |
static void |
trace(java.lang.String message,
java.lang.Object... args)
Deprecated.
Deprecated as of 2.7.0. Create an instance of
Logger.ALogger via of(String) / of(Class) and use the same-named method. Or use SLF4J directly. |
static void |
trace(java.lang.String message,
java.util.function.Supplier<?>... args)
Deprecated.
Deprecated as of 2.7.0. Create an instance of
Logger.ALogger via of(String) / of(Class) and use the same-named method. Or use SLF4J directly. |
static void |
trace(java.lang.String message,
java.lang.Throwable error)
Deprecated.
Deprecated as of 2.7.0. Create an instance of
Logger.ALogger via of(String) / of(Class) and use the same-named method. Or use SLF4J directly. |
static void |
trace(java.util.function.Supplier<java.lang.String> msgSupplier)
Deprecated.
Deprecated as of 2.7.0. Create an instance of
Logger.ALogger via of(String) / of(Class) and use the same-named method. Or use SLF4J directly. |
static org.slf4j.Logger |
underlying()
Deprecated.
Deprecated as of 2.7.0. Create an instance of
Logger.ALogger via of(String) / of(Class) and use the same-named method. Or use SLF4J directly. |
static void |
warn(java.lang.String message)
Deprecated.
Deprecated as of 2.7.0. Create an instance of
Logger.ALogger via of(String) / of(Class) and use the same-named method. Or use SLF4J directly. |
static void |
warn(java.lang.String message,
java.lang.Object... args)
Deprecated.
Deprecated as of 2.7.0. Create an instance of
Logger.ALogger via of(String) / of(Class) and use the same-named method. Or use SLF4J directly. |
static void |
warn(java.lang.String message,
java.util.function.Supplier<?>... args)
Deprecated.
Deprecated as of 2.7.0. Create an instance of
Logger.ALogger via of(String) / of(Class) and use the same-named method. Or use SLF4J directly. |
static void |
warn(java.lang.String message,
java.lang.Throwable error)
Deprecated.
Deprecated as of 2.7.0. Create an instance of
Logger.ALogger via of(String) / of(Class) and use the same-named method. Or use SLF4J directly. |
static void |
warn(java.util.function.Supplier<java.lang.String> msgSupplier)
Deprecated.
Deprecated as of 2.7.0. Create an instance of
Logger.ALogger via of(String) / of(Class) and use the same-named method. Or use SLF4J directly. |
public static Logger.ALogger of(java.lang.String name)
name
- name of the loggerpublic static Logger.ALogger of(java.lang.Class<?> clazz)
clazz
- a class whose name will be used as logger name@Deprecated public static org.slf4j.Logger underlying()
Logger.ALogger
via of(String)
/ of(Class)
and use the same-named method. Or use SLF4J directly.@Deprecated public static boolean isTraceEnabled()
Logger.ALogger
via of(String)
/ of(Class)
and use the same-named method. Or use SLF4J directly.true
if the logger instance enabled for the TRACE level?true
if the logger instance enabled for the TRACE level?@Deprecated public static boolean isDebugEnabled()
Logger.ALogger
via of(String)
/ of(Class)
and use the same-named method. Or use SLF4J directly.true
if the logger instance enabled for the DEBUG level?true
if the logger instance enabled for the DEBUG level?@Deprecated public static boolean isInfoEnabled()
Logger.ALogger
via of(String)
/ of(Class)
and use the same-named method. Or use SLF4J directly.true
if the logger instance enabled for the INFO level?true
if the logger instance enabled for the INFO level?@Deprecated public static boolean isWarnEnabled()
Logger.ALogger
via of(String)
/ of(Class)
and use the same-named method. Or use SLF4J directly.true
if the logger instance enabled for the WARN level?true
if the logger instance enabled for the WARN level?@Deprecated public static boolean isErrorEnabled()
Logger.ALogger
via of(String)
/ of(Class)
and use the same-named method. Or use SLF4J directly.true
if the logger instance enabled for the ERROR level?true
if the logger instance enabled for the ERROR level?@Deprecated public static void trace(java.lang.String message)
Logger.ALogger
via of(String)
/ of(Class)
and use the same-named method. Or use SLF4J directly.message
- message to log@Deprecated public static void trace(java.util.function.Supplier<java.lang.String> msgSupplier)
Logger.ALogger
via of(String)
/ of(Class)
and use the same-named method. Or use SLF4J directly.msgSupplier
- Supplier
that contains message to log@Deprecated public static void trace(java.lang.String message, java.lang.Object... args)
Logger.ALogger
via of(String)
/ of(Class)
and use the same-named method. Or use SLF4J directly.message
- message to logargs
- The arguments to apply to the message String@Deprecated public static void trace(java.lang.String message, java.util.function.Supplier<?>... args)
Logger.ALogger
via of(String)
/ of(Class)
and use the same-named method. Or use SLF4J directly.message
- message to logargs
- Suppliers that contain arguments to apply to the message String@Deprecated public static void trace(java.lang.String message, java.lang.Throwable error)
Logger.ALogger
via of(String)
/ of(Class)
and use the same-named method. Or use SLF4J directly.message
- message to logerror
- associated exception@Deprecated public static void debug(java.lang.String message)
Logger.ALogger
via of(String)
/ of(Class)
and use the same-named method. Or use SLF4J directly.message
- message to log@Deprecated public static void debug(java.util.function.Supplier<java.lang.String> msgSupplier)
Logger.ALogger
via of(String)
/ of(Class)
and use the same-named method. Or use SLF4J directly.msgSupplier
- Supplier
that contains message to log@Deprecated public static void debug(java.lang.String message, java.lang.Object... args)
Logger.ALogger
via of(String)
/ of(Class)
and use the same-named method. Or use SLF4J directly.message
- message to logargs
- The arguments to apply to the message String@Deprecated public static void debug(java.lang.String message, java.util.function.Supplier<?>... args)
Logger.ALogger
via of(String)
/ of(Class)
and use the same-named method. Or use SLF4J directly.message
- message to logargs
- Suppliers that contain arguments to apply to the message String@Deprecated public static void debug(java.lang.String message, java.lang.Throwable error)
Logger.ALogger
via of(String)
/ of(Class)
and use the same-named method. Or use SLF4J directly.message
- message to logerror
- associated exception@Deprecated public static void info(java.lang.String message)
Logger.ALogger
via of(String)
/ of(Class)
and use the same-named method. Or use SLF4J directly.message
- message to log@Deprecated public static void info(java.util.function.Supplier<java.lang.String> msgSupplier)
Logger.ALogger
via of(String)
/ of(Class)
and use the same-named method. Or use SLF4J directly.msgSupplier
- Supplier
that contains message to log@Deprecated public static void info(java.lang.String message, java.lang.Object... args)
Logger.ALogger
via of(String)
/ of(Class)
and use the same-named method. Or use SLF4J directly.message
- message to logargs
- The arguments to apply to the message string@Deprecated public static void info(java.lang.String message, java.util.function.Supplier<?>... args)
Logger.ALogger
via of(String)
/ of(Class)
and use the same-named method. Or use SLF4J directly.message
- message to logargs
- Suppliers that contain arguments to apply to the message String@Deprecated public static void info(java.lang.String message, java.lang.Throwable error)
Logger.ALogger
via of(String)
/ of(Class)
and use the same-named method. Or use SLF4J directly.message
- message to logerror
- associated exception@Deprecated public static void warn(java.lang.String message)
Logger.ALogger
via of(String)
/ of(Class)
and use the same-named method. Or use SLF4J directly.message
- message to log@Deprecated public static void warn(java.util.function.Supplier<java.lang.String> msgSupplier)
Logger.ALogger
via of(String)
/ of(Class)
and use the same-named method. Or use SLF4J directly.msgSupplier
- Supplier
that contains message to log@Deprecated public static void warn(java.lang.String message, java.lang.Object... args)
Logger.ALogger
via of(String)
/ of(Class)
and use the same-named method. Or use SLF4J directly.message
- message to logargs
- The arguments to apply to the message string@Deprecated public static void warn(java.lang.String message, java.util.function.Supplier<?>... args)
Logger.ALogger
via of(String)
/ of(Class)
and use the same-named method. Or use SLF4J directly.message
- message to logargs
- Suppliers that contain arguments to apply to the message String@Deprecated public static void warn(java.lang.String message, java.lang.Throwable error)
Logger.ALogger
via of(String)
/ of(Class)
and use the same-named method. Or use SLF4J directly.message
- message to logerror
- associated exception@Deprecated public static void error(java.lang.String message)
Logger.ALogger
via of(String)
/ of(Class)
and use the same-named method. Or use SLF4J directly.message
- message to log@Deprecated public static void error(java.util.function.Supplier<java.lang.String> msgSupplier)
Logger.ALogger
via of(String)
/ of(Class)
and use the same-named method. Or use SLF4J directly.msgSupplier
- Supplier
that contains message to log@Deprecated public static void error(java.lang.String message, java.lang.Object... args)
Logger.ALogger
via of(String)
/ of(Class)
and use the same-named method. Or use SLF4J directly.message
- message to logargs
- The arguments to apply to the message string@Deprecated public static void error(java.lang.String message, java.util.function.Supplier<?> args)
Logger.ALogger
via of(String)
/ of(Class)
and use the same-named method. Or use SLF4J directly.message
- message to logargs
- Suppliers that contain arguments to apply to the message String@Deprecated public static void error(java.lang.String message, java.lang.Throwable error)
Logger.ALogger
via of(String)
/ of(Class)
and use the same-named method. Or use SLF4J directly.message
- message to logerror
- associated exception