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 PersonalJava e MIDP environments.
For instance, in order to log the warning message "Attention!", the following code should be used, independently of the target device:
Logger logger = Logger.getJADELogger(this.getClass().getName());
if (logger.isLoggable(logger.WARNING))
logger.log(Logger.WARNING,"Attention!");
Notice that the test isLoggable
allows just to improve performance, but it has no side-effect.
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 (available in the LEAP add-on) 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 (available in the LEAP add-on) 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.
The default level for logging is set to INFO, all messages of higher level will be logged by default. In MIDP and PJava the logging level for a Logger object registererd 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.
@author Rosalba Bochicchio - TILAB
@author Nicolas Lhuillier - Motorola (MIDP version)
|
|
|
|