public class Logger extends java.util.logging.Logger implements Serializable
SEVERE (highest value)
WARNING
INFO
CONFIG
FINE
FINER
FINEST (lowest value)
In addition, there is a level OFF that can be used to turn off logging, and a level ALL that can be used to enable logging of all messages.
Notice that re-definition of logging levels was necessary in order to allow portability of calling code in environments where Java Logging is not supported.
For instance, in order to log the warning message "Attention!", the
following code can be used, independently of the target environment:
Logger logger = Logger.getJADELogger(this.getClass().getName());
logger.log(Logger.WARNING,"Attention!");
J2SE
The J2SE implementation is a pure
extension of the java.util.logging.Logger
class and
it provides the whole set of
functionalities of java.util.logging.
In the J2SE environment, the logging configuration can be initialized by using a logging
configuration file that will be read at startup. This file is in standard
java.util.Properties format. The default logging configuration,
that is part of the JRE distribution,
can be overridden by setting the java.util.logging.config.file
system property, like the following example:
java -Djava.util.logging.config.file=mylogging.properties jade.Boot ...
PersonaJava
In the PJava implementation of the Logger
class calls to the
log()
method result in calls to System.out.println()
.
Alternatively it is possible to redirect logging printouts to a text file
by setting the -jade_util_Logger_logfile
option. Note that,
in order to face resource limitations, it is not possible to redirect
logging printouts produced by different Logger objects to different files.
MIDP
In the MIDP implementation of the Logger
class logging printouts
are redirected to a MIDP RecordStore so that they can be later viewed
by means of the jade.util.leap.OutputViewer
MIDlet included
in the LEAP add-on.
Android
In the Android implementation of the Logger
class logging printouts
are redirected to the Android logging system implemented by the android.util.Log
class.
The default level for logging is set to INFO, all messages of higher level
will be logged by default.
In MIDP, PJava and Android environments, the logging level for a Logger object
registered with name x.y.z can be configured by setting the configuration option
x_y_z_loglevel
to one of severe, warning, info, config,
fine, finer, finest, all
. See the LEAP user guide for details about
how to set JADE configuration options in MIDP and PJava.
Modifier and Type | Field and Description |
---|---|
static java.util.logging.Level |
ALL
ALL indicates that all messages should be logged.
|
static java.util.logging.Level |
CONFIG
CONFIG is a message level for static configuration messages.
|
static java.util.logging.Level |
FINE
FINE is a message level providing tracing information.
|
static java.util.logging.Level |
FINER
FINER indicates a fairly detailed tracing message.
|
static java.util.logging.Level |
FINEST
FINEST indicates a highly detailed tracing message
|
static java.util.logging.Level |
INFO
INFO is a message level for informational messages.
|
static java.util.logging.Level |
OFF
Special level to be used to turn off logging
|
static java.util.logging.Level |
SEVERE
SEVERE is a message level indicating a serious failure.
|
static java.util.logging.Level |
WARNING
WARNING is a message level indicating a potential problem.
|
Modifier and Type | Method and Description |
---|---|
static Logger |
getJADELogger(java.lang.String name)
Find or create a logger for a named subsystem.
|
static Logger |
getMyLogger(java.lang.String name) |
static void |
initialize(Properties pp)
Initialize the logging mechanism.
|
static void |
println(java.lang.String log) |
addHandler, config, config, entering, entering, entering, exiting, exiting, fine, fine, finer, finer, finest, finest, getAnonymousLogger, getAnonymousLogger, getFilter, getGlobal, getHandlers, getLevel, getLogger, getLogger, getName, getParent, getResourceBundle, getResourceBundleName, getUseParentHandlers, info, info, isLoggable, log, log, log, log, log, log, log, logp, logp, logp, logp, logp, logp, logrb, logrb, logrb, logrb, logrb, logrb, removeHandler, setFilter, setLevel, setParent, setResourceBundle, setUseParentHandlers, severe, severe, throwing, warning, warning
public static final java.util.logging.Level SEVERE
public static final java.util.logging.Level WARNING
public static final java.util.logging.Level INFO
public static final java.util.logging.Level CONFIG
public static final java.util.logging.Level FINE
public static final java.util.logging.Level FINER
public static final java.util.logging.Level FINEST
public static final java.util.logging.Level ALL
public static final java.util.logging.Level OFF
public static Logger getJADELogger(java.lang.String name)
name
- The name of the logger.public static void initialize(Properties pp)
public static Logger getMyLogger(java.lang.String name)
public static void println(java.lang.String log)