public interface Logger
The int levels define a set of standard logging levels that can be used to control logging output. The logging levels are ordered and are specified by ordered integers. Enabling logging at a given level also enables logging at all higher levels.
Clients should use the the convenience methods such as severe() and fine() or one of the predefined level constants such as Logger.SEVERE and Logger.FINE with the appropriate log(int level...) or trace(int level...) methods.
The levels in descending order are:
Modifier and Type | Field and Description |
---|---|
static int |
CONFIG
CONFIG is a message level for static configuration messages.
|
static int |
FINE
FINE is a message level providing tracing information.
|
static int |
FINER
FINER indicates a fairly detailed tracing message.
|
static int |
FINEST
FINEST indicates a highly detailed tracing message.
|
static int |
INFO
INFO is a message level for informational messages.
|
static int |
SEVERE
SEVERE is a message level indicating a serious failure.
|
static int |
WARNING
WARNING is a message level indicating a potential problem.
|
Modifier and Type | Method and Description |
---|---|
void |
config(java.lang.String sourceClass,
java.lang.String sourceMethod,
int errorCode)
Log a message, specifying source class and method, if the logger is
currently enabled for the given message level.
|
void |
config(java.lang.String sourceClass,
java.lang.String sourceMethod,
int errorCode,
java.lang.Object[] inserts)
Log a message, specifying source class and method, with an array of
object arguments, if the logger is currently enabled for the given
message level.
|
void |
config(java.lang.String sourceClass,
java.lang.String sourceMethod,
int errorCode,
java.lang.Object[] inserts,
java.lang.Throwable thrown)
Log a message, specifying source class and method, with an array of
object arguments and a throwable, if the logger is currently enabled for
the given message level.
|
void |
dumpTrace() |
void |
fine(java.lang.String sourceClass,
java.lang.String sourceMethod,
int errorCode)
Trace a message, specifying source class and method, if the logger is
currently enabled for the given message level.
|
void |
fine(java.lang.String sourceClass,
java.lang.String sourceMethod,
int errorCode,
java.lang.Object[] inserts)
Trace a message, specifying source class and method, with an array of
object arguments, if the logger is currently enabled for the given
message level.
|
void |
fine(java.lang.String sourceClass,
java.lang.String sourceMethod,
int errorCode,
java.lang.Object[] inserts,
java.lang.Throwable ex) |
void |
finer(java.lang.String sourceClass,
java.lang.String sourceMethod,
int errorCode)
Trace a message, specifying source class and method, if the logger is
currently enabled for the given message level.
|
void |
finer(java.lang.String sourceClass,
java.lang.String sourceMethod,
int errorCode,
java.lang.Object[] inserts)
Trace a message, specifying source class and method, with an array of
object arguments, if the logger is currently enabled for the given
message level.
|
void |
finer(java.lang.String sourceClass,
java.lang.String sourceMethod,
int errorCode,
java.lang.Object[] inserts,
java.lang.Throwable ex) |
void |
finest(java.lang.String sourceClass,
java.lang.String sourceMethod,
int errorCode)
Trace a message, specifying source class and method, if the logger is
currently enabled for the given message level.
|
void |
finest(java.lang.String sourceClass,
java.lang.String sourceMethod,
int errorCode,
java.lang.Object[] inserts)
Trace a message, specifying source class and method, with an array of
object arguments, if the logger is currently enabled for the given
message level.
|
void |
finest(java.lang.String sourceClass,
java.lang.String sourceMethod,
int errorCode,
java.lang.Object[] inserts,
java.lang.Throwable ex) |
void |
info(java.lang.String sourceClass,
java.lang.String sourceMethod,
int errorCode)
Log a message, specifying source class and method, if the logger is
currently enabled for the given message level.
|
void |
info(java.lang.String sourceClass,
java.lang.String sourceMethod,
int errorCode,
java.lang.Object[] inserts)
Log a message, specifying source class and method, with an array of
object arguments, if the logger is currently enabled for the given
message level.
|
void |
info(java.lang.String sourceClass,
java.lang.String sourceMethod,
int errorCode,
java.lang.Object[] inserts,
java.lang.Throwable thrown)
Log a message, specifying source class and method, with an array of
object arguments and a throwable, if the logger is currently enabled for
the given message level.
|
boolean |
isLoggable(int level)
Check if a message of the given level would actually be logged by this
logger.
|
void |
log(int level,
java.lang.String sourceClass,
java.lang.String sourceMethod,
int errorCode,
java.lang.Object[] inserts,
java.lang.Throwable thrown)
Log a message, specifying source class and method, with an array of
object arguments and a throwable, if the logger is currently enabled for
the given message level.
|
void |
setResourceName(java.lang.String logContext)
Set a name that can be used to provide context with each log record.
|
void |
severe(java.lang.String sourceClass,
java.lang.String sourceMethod,
int errorCode)
Log a message, specifying source class and method, if the logger is
currently enabled for the given message level.
|
void |
severe(java.lang.String sourceClass,
java.lang.String sourceMethod,
int errorCode,
java.lang.Object[] inserts)
Log a message, specifying source class and method, with an array of
object arguments, if the logger is currently enabled for the given
message level.
|
void |
severe(java.lang.String sourceClass,
java.lang.String sourceMethod,
int errorCode,
java.lang.Object[] inserts,
java.lang.Throwable thrown)
Log a message, specifying source class and method, with an array of
object arguments and a throwable, if the logger is currently enabled for
the given message level.
|
void |
trace(int level,
java.lang.String sourceClass,
java.lang.String sourceMethod,
int errorCode,
java.lang.Object[] inserts,
java.lang.Throwable ex)
Log a trace message, specifying source class and method, with an array of
object arguments and a throwable, if the logger is currently enabled for
the given message level.
|
void |
warning(java.lang.String sourceClass,
java.lang.String sourceMethod,
int errorCode)
Log a message, specifying source class and method, if the logger is
currently enabled for the given message level.
|
void |
warning(java.lang.String sourceClass,
java.lang.String sourceMethod,
int errorCode,
java.lang.Object[] inserts)
Log a message, specifying source class and method, with an array of
object arguments, if the logger is currently enabled for the given
message level.
|
void |
warning(java.lang.String sourceClass,
java.lang.String sourceMethod,
int errorCode,
java.lang.Object[] inserts,
java.lang.Throwable thrown)
Log a message, specifying source class and method, with an array of
object arguments and a throwable, if the logger is currently enabled for
the given message level.
|
static final int SEVERE
In general SEVERE messages should describe events that are of considerable importance and which will prevent normal program execution. They should be reasonably intelligible to end users and to system administrators.
static final int WARNING
In general WARNING messages should describe events that will be of interest to end users or system managers, or which indicate potential problems.
static final int INFO
Typically INFO messages will be written to the console or its equivalent. So the INFO level should only be used for reasonably significant messages that will make sense to end users and system admins.
static final int CONFIG
CONFIG messages are intended to provide a variety of static configuration information, to assist in debugging problems that may be associated with particular configurations. For example, CONFIG message might include the CPU type, the graphics depth, the GUI look-and-feel, etc.
static final int FINE
All of FINE, FINER, and FINEST are intended for relatively detailed tracing. The exact meaning of the three levels will vary between subsystems, but in general, FINEST should be used for the most voluminous detailed output, FINER for somewhat less detailed output, and FINE for the lowest volume (and most important) messages.
In general the FINE level should be used for information that will be broadly interesting to developers who do not have a specialized interest in the specific subsystem.
FINE messages might include things like minor (recoverable) failures. Issues indicating potential performance problems are also worth logging as FINE.
static final int FINER
static final int FINEST
void setResourceName(java.lang.String logContext)
boolean isLoggable(int level)
level
- a message logging level.void severe(java.lang.String sourceClass, java.lang.String sourceMethod, int errorCode)
sourceClass
- Name of class that issued the logging request.sourceMethod
- Name of method that issued the logging request.errorCode
- Message indexvoid severe(java.lang.String sourceClass, java.lang.String sourceMethod, int errorCode, java.lang.Object[] inserts)
sourceClass
- Name of class that issued the logging request.sourceMethod
- Name of method that issued the logging request.errorCode
- Message indexinserts
- Array of parameters to the message.void severe(java.lang.String sourceClass, java.lang.String sourceMethod, int errorCode, java.lang.Object[] inserts, java.lang.Throwable thrown)
sourceClass
- Name of class that issued the logging request.sourceMethod
- Name of method that issued the logging request.errorCode
- Message indexinserts
- Array of parameters to the message.thrown
- Throwable associated with log message.void warning(java.lang.String sourceClass, java.lang.String sourceMethod, int errorCode)
sourceClass
- Name of class that issued the logging request.sourceMethod
- Name of method that issued the logging request.errorCode
- Message indexvoid warning(java.lang.String sourceClass, java.lang.String sourceMethod, int errorCode, java.lang.Object[] inserts)
sourceClass
- Name of class that issued the logging request.sourceMethod
- Name of method that issued the logging request.errorCode
- Message indexinserts
- Array of parameters to the message.void warning(java.lang.String sourceClass, java.lang.String sourceMethod, int errorCode, java.lang.Object[] inserts, java.lang.Throwable thrown)
sourceClass
- Name of class that issued the logging request.sourceMethod
- Name of method that issued the logging request.errorCode
- Message indexinserts
- Array of parameters to the message.thrown
- Throwable associated with log message.void info(java.lang.String sourceClass, java.lang.String sourceMethod, int errorCode)
sourceClass
- Name of class that issued the logging request.sourceMethod
- Name of method that issued the logging request.errorCode
- Message indexvoid info(java.lang.String sourceClass, java.lang.String sourceMethod, int errorCode, java.lang.Object[] inserts)
sourceClass
- Name of class that issued the logging request.sourceMethod
- Name of method that issued the logging request.errorCode
- Message indexinserts
- Array of parameters to the message.void info(java.lang.String sourceClass, java.lang.String sourceMethod, int errorCode, java.lang.Object[] inserts, java.lang.Throwable thrown)
sourceClass
- Name of class that issued the logging request.sourceMethod
- Name of method that issued the logging request.errorCode
- Message indexinserts
- Array of parameters to the message.thrown
- Throwable associated with log message.void config(java.lang.String sourceClass, java.lang.String sourceMethod, int errorCode)
sourceClass
- Name of class that issued the logging request.sourceMethod
- Name of method that issued the logging request.errorCode
- Message indexvoid config(java.lang.String sourceClass, java.lang.String sourceMethod, int errorCode, java.lang.Object[] inserts)
sourceClass
- Name of class that issued the logging request.sourceMethod
- Name of method that issued the logging request.errorCode
- Message indexinserts
- Array of parameters to the message.void config(java.lang.String sourceClass, java.lang.String sourceMethod, int errorCode, java.lang.Object[] inserts, java.lang.Throwable thrown)
sourceClass
- Name of class that issued the logging request.sourceMethod
- Name of method that issued the logging request.errorCode
- Message indexinserts
- Array of parameters to the message.thrown
- Throwable associated with log message.void fine(java.lang.String sourceClass, java.lang.String sourceMethod, int errorCode)
sourceClass
- Name of class that issued the logging request.sourceMethod
- Name of method that issued the logging request.errorCode
- Message indexvoid fine(java.lang.String sourceClass, java.lang.String sourceMethod, int errorCode, java.lang.Object[] inserts)
sourceClass
- Name of class that issued the logging request.sourceMethod
- Name of method that issued the logging request.errorCode
- Message indexinserts
- Array of parameters to the message.void fine(java.lang.String sourceClass, java.lang.String sourceMethod, int errorCode, java.lang.Object[] inserts, java.lang.Throwable ex)
void finer(java.lang.String sourceClass, java.lang.String sourceMethod, int errorCode)
sourceClass
- Name of class that issued the logging request.sourceMethod
- Name of method that issued the logging request.errorCode
- Message indexvoid finer(java.lang.String sourceClass, java.lang.String sourceMethod, int errorCode, java.lang.Object[] inserts)
sourceClass
- Name of class that issued the logging request.sourceMethod
- Name of method that issued the logging request.errorCode
- Message indexinserts
- Array of parameters to the message.void finer(java.lang.String sourceClass, java.lang.String sourceMethod, int errorCode, java.lang.Object[] inserts, java.lang.Throwable ex)
void finest(java.lang.String sourceClass, java.lang.String sourceMethod, int errorCode)
sourceClass
- Name of class that issued the logging request.sourceMethod
- Name of method that issued the logging request.errorCode
- Message indexvoid finest(java.lang.String sourceClass, java.lang.String sourceMethod, int errorCode, java.lang.Object[] inserts)
sourceClass
- Name of class that issued the logging request.sourceMethod
- Name of method that issued the logging request.errorCode
- Message indexinserts
- Array of parameters to the message.void finest(java.lang.String sourceClass, java.lang.String sourceMethod, int errorCode, java.lang.Object[] inserts, java.lang.Throwable ex)
void log(int level, java.lang.String sourceClass, java.lang.String sourceMethod, int errorCode, java.lang.Object[] inserts, java.lang.Throwable thrown)
level
- One of the message level identifiers, e.g. SEVERE.sourceClass
- Name of class that issued the logging request.sourceMethod
- Name of method that issued the logging request.errorCode
- Message indexinserts
- Array of parameters to the message, may be null.thrown
- Throwable associated with log message.void trace(int level, java.lang.String sourceClass, java.lang.String sourceMethod, int errorCode, java.lang.Object[] inserts, java.lang.Throwable ex)
level
- One of the message level identifiers, e.g. SEVERE.sourceClass
- Name of class that issued the logging request.sourceMethod
- Name of method that issued the logging request.errorCode
- Message indexinserts
- Array of parameters to the message, may be null.void dumpTrace()