|
istack common utility code 2.6.1-redhat-2 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.istack.logging.Logger
public class Logger
This is a helper class that provides some conveniece methods wrapped around the
standard Logger
interface.
The class also makes sure that logger names of each Metro subsystem are consistent
with each other.
Constructor Summary | |
---|---|
protected |
Logger(String systemLoggerName,
String componentName)
Prevents creation of a new instance of this Logger unless used by a subclass. |
Method Summary | ||
---|---|---|
void |
config(String message)
|
|
void |
config(String message,
Throwable thrown)
|
|
void |
entering()
|
|
void |
entering(Object... parameters)
|
|
void |
exiting()
|
|
void |
exiting(Object result)
|
|
void |
fine(String message)
|
|
void |
fine(String message,
Throwable thrown)
|
|
void |
finer(String message)
|
|
void |
finer(String message,
Throwable thrown)
|
|
void |
finest(String message)
|
|
void |
finest(String message,
Throwable thrown)
|
|
static Logger |
getLogger(Class<?> componentClass)
The factory method returns preconfigured Logger wrapper for the class. |
|
static Logger |
getLogger(String customLoggerName,
Class<?> componentClass)
The factory method returns preconfigured Logger wrapper for the class. |
|
void |
info(String message)
|
|
void |
info(String message,
Throwable thrown)
|
|
boolean |
isLoggable(Level level)
|
|
boolean |
isMethodCallLoggable()
|
|
void |
log(Level level,
String message)
|
|
void |
log(Level level,
String message,
Throwable thrown)
|
|
|
logException(T exception,
boolean logCause,
Level level)
Method logs exception 's message at the logging level specified by the
level argument. |
|
|
logException(T exception,
Level level)
Same as logException(exception, true, level) . |
|
|
logException(T exception,
Throwable cause,
Level level)
Method logs exception 's message at the logging level specified by the
level argument. |
|
|
logSevereException(T exception)
Same as logSevereException(exception, true) . |
|
|
logSevereException(T exception,
boolean logCause)
Method logs exception 's message as a SEVERE logging level
message. |
|
|
logSevereException(T exception,
Throwable cause)
Method logs exception 's message as a SEVERE logging level
message. |
|
void |
setLevel(Level level)
|
|
void |
severe(String message)
|
|
void |
severe(String message,
Throwable thrown)
|
|
void |
warning(String message)
|
|
void |
warning(String message,
Throwable thrown)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected Logger(String systemLoggerName, String componentName)
Method Detail |
---|
@NotNull public static Logger getLogger(@NotNull 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
.
NullPointerException
- if the componentClass parameter is null
.@NotNull public static Logger getLogger(@NotNull String customLoggerName, @NotNull 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
.
NullPointerException
- if the componentClass parameter is null
.getLogger(java.lang.Class)
public void log(Level level, String message)
public void log(Level level, String message, Throwable thrown)
public void finest(String message)
public void finest(String message, Throwable thrown)
public void finer(String message)
public void finer(String message, Throwable thrown)
public void fine(String message)
public void fine(String message, Throwable thrown)
public void info(String message)
public void info(String message, Throwable thrown)
public void config(String message)
public void config(String message, Throwable thrown)
public void warning(String message)
public void warning(String message, Throwable thrown)
public void severe(String message)
public void severe(String message, Throwable thrown)
public boolean isMethodCallLoggable()
public boolean isLoggable(Level level)
public void setLevel(Level level)
public void entering()
public void entering(Object... parameters)
public void exiting()
public void exiting(Object result)
public <T extends Throwable> T logSevereException(T exception, 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 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 well
exception
parameter.public <T extends Throwable> T logSevereException(T exception)
logSevereException(exception, true)
.
public <T extends Throwable> T logException(T exception, Throwable cause, 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 logging
exception
parameter.public <T extends Throwable> T logException(T exception, boolean logCause, 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 logging
exception
parameter.public <T extends Throwable> T logException(T exception, Level level)
logException(exception, true, level)
.
|
istack common utility code 2.6.1-redhat-2 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |