public final class Log
extends java.lang.Object
Logger class to have a minimum level of
abstraction and a clear level semantics.| Modifier and Type | Field and Description |
|---|---|
static java.util.logging.Level |
LEVEL_DEBUG
Log level for debug messages.
|
static java.util.logging.Level |
LEVEL_ERROR
Log level for error messages.
|
static java.util.logging.Level |
LEVEL_INFO
Log level for info messages.
|
static java.util.logging.Level |
LEVEL_NOTICE
Log level for notice messages used to record fundamental application
states and events.
|
static java.util.logging.Level |
LEVEL_WARNING
Log level for warning messages.
|
| Constructor and Description |
|---|
Log(java.lang.Class<?> clazz)
Construct
Log. |
Log(java.lang.Class<?> clazz,
java.util.ResourceBundle bundle)
Construct
Log. |
| Modifier and Type | Method and Description |
|---|---|
void |
debug(java.util.ResourceBundle bundle,
java.lang.String format,
java.lang.Object... args)
Log a debug message.
|
void |
debug(java.lang.Throwable thrown,
java.util.ResourceBundle bundle,
java.lang.String format,
java.lang.Object... args)
Log a debug message.
|
void |
error(java.util.ResourceBundle bundle,
java.lang.String format,
java.lang.Object... args)
Log a error message.
|
void |
error(java.lang.Throwable thrown,
java.util.ResourceBundle bundle,
java.lang.String format,
java.lang.Object... args)
Log a error message.
|
java.util.logging.Logger |
getLogger()
Get the underlying JDK Logger.
|
void |
info(java.util.ResourceBundle bundle,
java.lang.String format,
java.lang.Object... args)
Log a info message.
|
void |
info(java.lang.Throwable thrown,
java.util.ResourceBundle bundle,
java.lang.String format,
java.lang.Object... args)
Log a info message.
|
boolean |
isDebugLoggable()
Check whether debug log level is currently logged.
|
boolean |
isInfoLoggable()
Check whether info log level is currently logged.
|
boolean |
isLoggable(java.util.logging.Level level)
Check whether a log level is currently logged.
|
static java.lang.String |
levelToString(java.util.logging.Level level)
Get the level string.
|
void |
log(java.util.logging.Level level,
java.lang.Throwable thrown,
java.util.ResourceBundle bundle,
java.lang.String format,
java.lang.Object... args)
Log a message.
|
void |
notice(java.util.ResourceBundle bundle,
java.lang.String format,
java.lang.Object... args)
Log a notice message.
|
void |
notice(java.lang.Throwable thrown,
java.util.ResourceBundle bundle,
java.lang.String format,
java.lang.Object... args)
Log a notice message.
|
static java.util.logging.Level |
snapLevel(java.util.logging.Level level)
Map a level to the best matching standard level.
|
void |
warning(java.util.ResourceBundle bundle,
java.lang.String format,
java.lang.Object... args)
Log a warning message.
|
void |
warning(java.lang.Throwable thrown,
java.util.ResourceBundle bundle,
java.lang.String format,
java.lang.Object... args)
Log a warning message.
|
public static final java.util.logging.Level LEVEL_NOTICE
public static final java.util.logging.Level LEVEL_ERROR
public static final java.util.logging.Level LEVEL_WARNING
public static final java.util.logging.Level LEVEL_INFO
public static final java.util.logging.Level LEVEL_DEBUG
public Log(java.lang.Class<?> clazz)
Log.clazz - The class to derive the log name from.public Log(java.lang.Class<?> clazz,
java.util.ResourceBundle bundle)
Log.clazz - The class to derive the log name from.bundle - The (optional) ResourceBundle to use for message
localization.public java.util.logging.Logger getLogger()
public boolean isLoggable(java.util.logging.Level level)
level - The level to check.public void log(java.util.logging.Level level,
java.lang.Throwable thrown,
java.util.ResourceBundle bundle,
java.lang.String format,
java.lang.Object... args)
See MessageFormat.format(String, Object...) for format
options.
level - The log level.thrown - The (optional) Throwable to log.bundle - The (optional) ResourceBundle to use for message
localization.format - The log message.args - The (optional) log message parameters.public void notice(java.util.ResourceBundle bundle,
java.lang.String format,
java.lang.Object... args)
See MessageFormat.format(String, Object...) for format
options.
bundle - The (optional) ResourceBundle to use for message
localization.format - The log message.args - The (optional) log message parameters.public void notice(java.lang.Throwable thrown,
java.util.ResourceBundle bundle,
java.lang.String format,
java.lang.Object... args)
See MessageFormat.format for format options.
thrown - The (optional) Throwable to
log.bundle - The (optional) ResourceBundle to use for message
localization.format - The log message.args - The (optional) log message parameters.public void error(java.util.ResourceBundle bundle,
java.lang.String format,
java.lang.Object... args)
See MessageFormat.format(String, Object...) for format
options.
bundle - The (optional) ResourceBundle to use for message
localization.format - The log message.args - The (optional) log message parameters.public void error(java.lang.Throwable thrown,
java.util.ResourceBundle bundle,
java.lang.String format,
java.lang.Object... args)
See MessageFormat.format for format options.
thrown - The (optional) Throwable to
log.bundle - The (optional) ResourceBundle to use for message
localization.format - The log message.args - The (optional) log message parameters.public void warning(java.util.ResourceBundle bundle,
java.lang.String format,
java.lang.Object... args)
See MessageFormat.format(String, Object...) for format
options.
bundle - The (optional) ResourceBundle to use for message
localization.format - The log message.args - The (optional) log message parameters.public void warning(java.lang.Throwable thrown,
java.util.ResourceBundle bundle,
java.lang.String format,
java.lang.Object... args)
See MessageFormat.format for format options.
thrown - The (optional) Throwable to
log.bundle - The (optional) ResourceBundle to use for message
localization.format - The log message.args - The (optional) log message parameters.public boolean isInfoLoggable()
public void info(java.util.ResourceBundle bundle,
java.lang.String format,
java.lang.Object... args)
See MessageFormat.format(String, Object...) for format
options.
bundle - The (optional) ResourceBundle to use for message
localization.format - The log message.args - The (optional) log message parameters.public void info(java.lang.Throwable thrown,
java.util.ResourceBundle bundle,
java.lang.String format,
java.lang.Object... args)
See MessageFormat.format for format options.
thrown - The (optional) Throwable to
log.bundle - The (optional) ResourceBundle to use for message
localization.format - The log message.args - The (optional) log message parameters.public boolean isDebugLoggable()
public void debug(java.util.ResourceBundle bundle,
java.lang.String format,
java.lang.Object... args)
See MessageFormat.format(String, Object...) for format
options.
bundle - The (optional) ResourceBundle to use for message
localization.format - The log message.args - The (optional) log message parameters.public void debug(java.lang.Throwable thrown,
java.util.ResourceBundle bundle,
java.lang.String format,
java.lang.Object... args)
See MessageFormat.format for format options.
thrown - The (optional) Throwable to
log.bundle - The (optional) ResourceBundle to use for message
localization.format - The log message.args - The (optional) log message parameters.public static java.lang.String levelToString(java.util.logging.Level level)
level - The level to get the string for.public static java.util.logging.Level snapLevel(java.util.logging.Level level)
level - The level to map.