public class Logger extends Object
Modifier and Type | Field and Description |
---|---|
static int |
ALL
The
ALL level is used as a threshold for filtering log records,
meaning that every message should be logged. |
static int |
CONFIG
Log records whose level is
CONFIG are used for describing the
static configuration, for example the windowing environment, the operating
system version, etc. |
static int |
INFO
Log records whose level is
INFO are used in purely informational
situations that do not constitute serious errors or potential problems. |
static int |
OFF
The
OFF level is used as a threshold for filtering log records,
meaning that no message should be logged. |
static int |
SEVERE
Log records whose level is
SEVERE indicate a serious failure
that prevents normal program execution. |
static int |
WARNING
Log records whose level is
WARNING indicate a potential problem
that does not prevent normal program execution. |
Modifier and Type | Method and Description |
---|---|
static void |
config(String componentName,
String message)
Logs a message with severity level CONFIG.
|
int |
getLevel()
Returns the severity level threshold for this
Handler . |
static Logger |
getLogger() |
String |
getName()
Returns the name of this logger.
|
static void |
info(String componentName,
String message)
Logs a message with severity level INFO.
|
boolean |
isLoggable(int level)
Returns whether or not a message of the specified level would be logged by
this logger.
|
void |
log(String component,
int level,
String message) |
void |
log(String component,
int level,
String message,
Object param) |
void |
logp(String component,
int level,
String message,
Object[] params) |
void |
setLevel(int level)
Sets the severity level threshold for this
Handler . |
void |
setName(String subSystem) |
static void |
severe(String componentName,
String message)
Logs a message with severity level SEVERE, indicating a serious failure that
prevents normal program execution.
|
static void |
warning(String componentName,
String message)
Logs a message with severity level WARNING, indicating a potential problem
that does not prevent normal program execution.
|
public static final int ALL
ALL
level is used as a threshold for filtering log records,
meaning that every message should be logged.public static final int CONFIG
CONFIG
are used for describing the
static configuration, for example the windowing environment, the operating
system version, etc.public static final int INFO
INFO
are used in purely informational
situations that do not constitute serious errors or potential problems. In
the default logging configuration, INFO messages will be written to the
system console. For this reason, the INFO level should be used only for
messages that are important to end users and system administrators. Messages
at this level should be understandable to an inexperienced, non-technical
user.public static final int OFF
OFF
level is used as a threshold for filtering log records,
meaning that no message should be logged.public static final int SEVERE
SEVERE
indicate a serious failure
that prevents normal program execution. Messages at this level should be
understandable to an inexperienced, non-technical end user. Ideally, they
explain in simple words what actions the user can take in order to resolve
the problem.public static final int WARNING
WARNING
indicate a potential problem
that does not prevent normal program execution. Messages at this level should
be understandable to an inexperienced, non-technical end user. Ideally, they
explain in simple words what actions the user can take in order to resolve
the problem.public static void config(String componentName, String message)
componentName
- the component name where the message is from.message
- the message text, also used as look-up key if the logger is
localizing messages with a resource bundle. While it is possible
to pass null
, this is not recommended, since a
logging message without text is unlikely to be helpful.public int getLevel()
Handler
. All log
records with a lower severity level will be discarded; a log record of the
same or a higher level will be published unless an installed
Filter
decides to discard it.null
if the logger inherits the threshold from its
parent.public static Logger getLogger()
public String getName()
null
if the logger is
anonymous.public static void info(String componentName, String message)
componentName
- the component name where the message is from.message
- the message text, also used as look-up key if the logger is
localizing messages with a resource bundle. While it is possible
to pass null
, this is not recommended, since a
logging message without text is unlikely to be helpful.public boolean isLoggable(int level)
level
- specified level for checkingNullPointerException
- if level
is null
.public void setLevel(int level)
Handler
. All log
records with a lower severity level will be discarded immediately. A log
record of the same or a higher level will be published unless an installed
Filter
decides to discard it.level
- the severity level below which all log messages will be discarded,
or null
to indicate that the logger should inherit
the threshold from its parent.public void setName(String subSystem)
public static void severe(String componentName, String message)
componentName
- the component name where the message is from.message
- the message text, also used as look-up key if the logger is
localizing messages with a resource bundle. While it is possible
to pass null
, this is not recommended, since a
logging message without text is unlikely to be helpful.public static void warning(String componentName, String message)
componentName
- the component name where the message is from.message
- the message text, also used as look-up key if the logger is
localizing messages with a resource bundle. While it is possible
to pass null
, this is not recommended, since a
logging message without text is unlikely to be helpful.