Modifier | Constructor and Description |
---|---|
protected |
Logger(String systemLoggerName,
String componentName)
Prevents creation of a new instance of this Logger unless used by a subclass.
|
Modifier and Type | Method and Description |
---|---|
void |
config(String message) |
void |
config(String message,
Object[] params) |
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,
Object[] params) |
void |
finer(String message,
Throwable thrown) |
void |
finest(String message) |
void |
finest(String message,
Object[] params) |
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,
Object[] params) |
void |
info(String message,
Throwable thrown) |
boolean |
isLoggable(Level level) |
boolean |
isMethodCallLoggable() |
void |
log(Level level,
String message) |
void |
log(Level level,
String message,
Object param1) |
void |
log(Level level,
String message,
Object[] params) |
void |
log(Level level,
String message,
Throwable thrown) |
<T extends Throwable> |
logException(T exception,
boolean logCause,
Level level)
Method logs
exception 's message at the logging level specified by the
level argument. |
<T extends Throwable> |
logException(T exception,
Level level)
Same as
logException(exception, true, level) . |
<T extends Throwable> |
logException(T exception,
Throwable cause,
Level level)
Method logs
exception 's message at the logging level specified by the
level argument. |
<T extends Throwable> |
logSevereException(T exception)
Same as
logSevereException(exception, true) . |
<T extends Throwable> |
logSevereException(T exception,
boolean logCause)
Method logs
exception 's message as a SEVERE logging level
message. |
<T extends Throwable> |
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,
Object[] params) |
void |
severe(String message,
Throwable thrown) |
void |
warning(String message) |
void |
warning(String message,
Object[] params) |
void |
warning(String message,
Throwable thrown) |
@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 finest(String message)
public void finer(String message)
public void fine(String message)
public void info(String message)
public void config(String message)
public void warning(String message)
public void severe(String message)
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 wellexception
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 loggingexception
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 loggingexception
parameter.public <T extends Throwable> T logException(T exception, Level level)
logException(exception, true, level)
.Copyright © 2021 JBoss by Red Hat. All rights reserved.