public class Logger
extends java.lang.Object
Logger interface.
The class also makes sure that logger names of each Metro subsystem are consistent
with each other.| Modifier | Constructor | Description |
|---|---|---|
protected |
Logger(java.lang.String systemLoggerName,
java.lang.String componentName) |
Prevents creation of a new instance of this Logger unless used by a subclass.
|
| Modifier and Type | Method | Description |
|---|---|---|
void |
config(java.lang.String message) |
|
void |
config(java.lang.String message,
java.lang.Object[] params) |
|
void |
config(java.lang.String message,
java.lang.Throwable thrown) |
|
void |
entering() |
|
void |
entering(java.lang.Object... parameters) |
|
void |
exiting() |
|
void |
exiting(java.lang.Object result) |
|
void |
fine(java.lang.String message) |
|
void |
fine(java.lang.String message,
java.lang.Throwable thrown) |
|
void |
finer(java.lang.String message) |
|
void |
finer(java.lang.String message,
java.lang.Object[] params) |
|
void |
finer(java.lang.String message,
java.lang.Throwable thrown) |
|
void |
finest(java.lang.String message) |
|
void |
finest(java.lang.String message,
java.lang.Object[] params) |
|
void |
finest(java.lang.String message,
java.lang.Throwable thrown) |
|
static Logger |
getLogger(java.lang.Class<?> componentClass) |
The factory method returns preconfigured Logger wrapper for the class.
|
static Logger |
getLogger(java.lang.String customLoggerName,
java.lang.Class<?> componentClass) |
The factory method returns preconfigured Logger wrapper for the class.
|
void |
info(java.lang.String message) |
|
void |
info(java.lang.String message,
java.lang.Object[] params) |
|
void |
info(java.lang.String message,
java.lang.Throwable thrown) |
|
boolean |
isLoggable(java.util.logging.Level level) |
|
boolean |
isMethodCallLoggable() |
|
void |
log(java.util.logging.Level level,
java.lang.String message) |
|
void |
log(java.util.logging.Level level,
java.lang.String message,
java.lang.Object param1) |
|
void |
log(java.util.logging.Level level,
java.lang.String message,
java.lang.Object[] params) |
|
void |
log(java.util.logging.Level level,
java.lang.String message,
java.lang.Throwable thrown) |
|
<T extends java.lang.Throwable> |
logException(T exception,
boolean logCause,
java.util.logging.Level level) |
Method logs
exception's message at the logging level specified by the
level argument. |
<T extends java.lang.Throwable> |
logException(T exception,
java.lang.Throwable cause,
java.util.logging.Level level) |
Method logs
exception's message at the logging level specified by the
level argument. |
<T extends java.lang.Throwable> |
logException(T exception,
java.util.logging.Level level) |
Same as
logException(exception, true, level). |
<T extends java.lang.Throwable> |
logSevereException(T exception) |
Same as
logSevereException(exception, true). |
<T extends java.lang.Throwable> |
logSevereException(T exception,
boolean logCause) |
Method logs
exception's message as a SEVERE logging level
message. |
<T extends java.lang.Throwable> |
logSevereException(T exception,
java.lang.Throwable cause) |
Method logs
exception's message as a SEVERE logging level
message. |
void |
setLevel(java.util.logging.Level level) |
|
void |
severe(java.lang.String message) |
|
void |
severe(java.lang.String message,
java.lang.Object[] params) |
|
void |
severe(java.lang.String message,
java.lang.Throwable thrown) |
|
void |
warning(java.lang.String message) |
|
void |
warning(java.lang.String message,
java.lang.Object[] params) |
|
void |
warning(java.lang.String message,
java.lang.Throwable thrown) |
protected Logger(java.lang.String systemLoggerName,
java.lang.String componentName)
@NotNull public static Logger getLogger(@NotNull java.lang.Class<?> componentClass)
The factory method returns preconfigured Logger wrapper for the class. Method calls
getSystemLoggerName(java.lang.Class) to generate default logger name.
Since there is no caching implemented, it is advised that the method is called only once per a class in order to initialize a final static logger variable, which is then used through the class to perform actual logging tasks.
componentClass - class of the component that will use the logger instance. Must not be null.java.lang.NullPointerException - if the componentClass parameter is null.@NotNull public static Logger getLogger(@NotNull java.lang.String customLoggerName, @NotNull java.lang.Class<?> componentClass)
getLogger(java.lang.Class)
method.customLoggerName - custom name of the logger.componentClass - class of the component that will use the logger instance. Must not be null.java.lang.NullPointerException - if the componentClass parameter is null.getLogger(java.lang.Class)public void log(java.util.logging.Level level,
java.lang.String message)
public void log(java.util.logging.Level level,
java.lang.String message,
java.lang.Object param1)
public void log(java.util.logging.Level level,
java.lang.String message,
java.lang.Object[] params)
public void log(java.util.logging.Level level,
java.lang.String message,
java.lang.Throwable thrown)
public void finest(java.lang.String message)
public void finest(java.lang.String message,
java.lang.Object[] params)
public void finest(java.lang.String message,
java.lang.Throwable thrown)
public void finer(java.lang.String message)
public void finer(java.lang.String message,
java.lang.Object[] params)
public void finer(java.lang.String message,
java.lang.Throwable thrown)
public void fine(java.lang.String message)
public void fine(java.lang.String message,
java.lang.Throwable thrown)
public void info(java.lang.String message)
public void info(java.lang.String message,
java.lang.Object[] params)
public void info(java.lang.String message,
java.lang.Throwable thrown)
public void config(java.lang.String message)
public void config(java.lang.String message,
java.lang.Object[] params)
public void config(java.lang.String message,
java.lang.Throwable thrown)
public void warning(java.lang.String message)
public void warning(java.lang.String message,
java.lang.Object[] params)
public void warning(java.lang.String message,
java.lang.Throwable thrown)
public void severe(java.lang.String message)
public void severe(java.lang.String message,
java.lang.Object[] params)
public void severe(java.lang.String message,
java.lang.Throwable thrown)
public boolean isMethodCallLoggable()
public boolean isLoggable(java.util.logging.Level level)
public void setLevel(java.util.logging.Level level)
public void entering()
public void entering(java.lang.Object... parameters)
public void exiting()
public void exiting(java.lang.Object result)
public <T extends java.lang.Throwable> T logSevereException(T exception,
java.lang.Throwable cause)
exception's message as a SEVERE logging level
message.
If cause parameter is not null, it is logged as well and
exception original cause is initialized with instance referenced
by cause parameter.
exception - exception whose message should be logged. Must not be
null.cause - initial cause of the exception that should be logged as well
and set as exception's original cause. May be null.exception
parameter.public <T extends java.lang.Throwable> T logSevereException(T exception,
boolean logCause)
exception's message as a SEVERE logging level
message.
If logCause parameter is true, exception's original
cause is logged as well (if exists). This may be used in cases when
exception's class provides constructor to initialize the original
cause. In such case you do not need to use
logSevereException(Throwable, Throwable)
method version but you might still want to log the original cause as well.
exception - exception whose message should be logged. Must not be
null.logCause - deterimnes whether initial cause of the exception should
be logged as wellexception
parameter.public <T extends java.lang.Throwable> T logSevereException(T exception)
logSevereException(exception, true).public <T extends java.lang.Throwable> T logException(T exception,
java.lang.Throwable cause,
java.util.logging.Level level)
exception's message at the logging level specified by the
level argument.
If cause parameter is not null, it is logged as well and
exception original cause is initialized with instance referenced
by cause parameter.
exception - exception whose message should be logged. Must not be
null.cause - initial cause of the exception that should be logged as well
and set as exception's original cause. May be null.level - loging level which should be used for loggingexception
parameter.public <T extends java.lang.Throwable> T logException(T exception,
boolean logCause,
java.util.logging.Level level)
exception's message at the logging level specified by the
level argument.
If logCause parameter is true, exception's original
cause is logged as well (if exists). This may be used in cases when
exception's class provides constructor to initialize the original
cause. In such case you do not need to use
logException(exception, cause, level)
method version but you might still want to log the original cause as well.
exception - exception whose message should be logged. Must not be
null.logCause - deterimnes whether initial cause of the exception should
be logged as welllevel - loging level which should be used for loggingexception
parameter.public <T extends java.lang.Throwable> T logException(T exception,
java.util.logging.Level level)
logException(exception, true, level).Copyright © 2017 Oracle Corporation. All rights reserved.