public class Logger extends Object
| Modifier and Type | Method and Description |
|---|---|
void |
debug(String message)
Logs a message at DEBUG level.
|
void |
debug(String format,
Object... args)
Logs a message at DEBUG level.
|
void |
debug(Throwable exception,
String message)
Logs a message at DEBUG level.
|
void |
debug(Throwable exception,
String format,
Object... args)
Logs a message at DEBUG level.
|
void |
error(String message)
Logs a message at ERROR level.
|
void |
error(String format,
Object... args)
Logs a message at ERROR level.
|
void |
error(Throwable exception)
Logs a message at ERROR level.
|
void |
error(Throwable exception,
String message)
Logs a message at ERROR level.
|
void |
error(Throwable exception,
String format,
Object... args)
Logs a message at ERROR level.
|
static Logger |
get(Class<?> clazz)
Gets a logger named after a class' fully qualified name.
|
static Logger |
get(String name)
Gets a named logger
|
void |
info(String message)
Logs a message at INFO level.
|
void |
info(String format,
Object... args)
Logs a message at INFO level.
|
boolean |
isDebugEnabled() |
boolean |
isInfoEnabled() |
void |
warn(String message)
Logs a message at WARN level.
|
void |
warn(String format,
Object... args)
Logs a message at WARN level.
|
void |
warn(Throwable exception,
String message)
Logs a message at WARN level.
|
void |
warn(Throwable exception,
String format,
Object... args)
Logs a message at WARN level.
|
public static Logger get(Class<?> clazz)
clazz - the classpublic static Logger get(String name)
name - the name of the loggerpublic void debug(Throwable exception, String message)
exception - an exception associated with the debug message being loggedmessage - a literal message to logpublic void debug(String message)
message - a literal message to logpublic void debug(String format, Object... args)
Usage example:
logger.debug("value is %s (%d ms)", value, time);
If the format string is invalid or the arguments are insufficient, an error will be logged and execution
will continue.format - a format string compatible with String.format()args - arguments for the format stringpublic void debug(Throwable exception, String format, Object... args)
Usage example:
logger.debug(e, "value is %s (%d ms)", value, time);
If the format string is invalid or the arguments are insufficient, an error will be logged and execution
will continue.exception - an exception associated with the debug message being loggedformat - a format string compatible with String.format()args - arguments for the format stringpublic void info(String message)
message - a literal message to logpublic void info(String format, Object... args)
Usage example:
logger.info("value is %s (%d ms)", value, time);
If the format string is invalid or the arguments are insufficient, an error will be logged and execution
will continue.format - a format string compatible with String.format()args - arguments for the format stringpublic void warn(Throwable exception, String message)
exception - an exception associated with the warning being loggedmessage - a literal message to logpublic void warn(String message)
message - a literal message to logpublic void warn(Throwable exception, String format, Object... args)
Usage example:
logger.warn(e, "something bad happened when connecting to %s:%d", host, port);
If the format string is invalid or the arguments are insufficient, an error will be logged and execution
will continue.exception - an exception associated with the warning being loggedformat - a format string compatible with String.format()args - arguments for the format stringpublic void warn(String format, Object... args)
Usage example:
logger.warn("something bad happened when connecting to %s:%d", host, port);
If the format string is invalid or the arguments are insufficient, an error will be logged and execution
will continue.format - a format string compatible with String.format()args - arguments for the format stringpublic void error(Throwable exception, String message)
exception - an exception associated with the error being loggedmessage - a literal message to logpublic void error(String message)
message - a literal message to logpublic void error(Throwable exception, String format, Object... args)
Usage example:
logger.error(e, "something really bad happened when connecting to %s:%d", host, port);
If the format string is invalid or the arguments are insufficient, an error will be logged and execution
will continue.exception - an exception associated with the error being loggedformat - a format string compatible with String.format()args - arguments for the format stringpublic void error(Throwable exception)
exception.getMessage() will be used as the log message.
Usage example:
logger.error(e);
exception - an exception associated with the error being loggedpublic void error(String format, Object... args)
Usage example:
logger.error("something really bad happened when connecting to %s:%d", host, port);
If the format string is invalid or the arguments are insufficient, an error will be logged and execution
will continue.format - a format string compatible with String.format()args - arguments for the format stringpublic boolean isDebugEnabled()
public boolean isInfoEnabled()
Copyright © 2010–2022 Airlift. All rights reserved.