FileDocCategorySizeDatePackage
Logging.javaAPI DocphoneME MR2 API (J2ME)4392Wed May 02 18:00:10 BST 2007com.sun.midp.log

Logging

public class Logging extends LoggingBase
The purpose of the logging service is to provide a standard means to report runtime information from within Java or native code. The porting process is eased by having to modify one logging service implementation in place of handling the ad hoc use of println(), printf(), putc(), and other functions currently used. An assert mechanism for Java code, implemented using the logging service is also provided here for convenience. This class consists of the Java interface to the functionality of the logging service.

Fields Summary
public static final int
REPORT_LEVEL
Flag allowing client code with reporting levels less than this to be compiled out of the build. Callers should use this flag as a way to remove bytecodes related to unneeded levels of reporting from the resulting classfiles. For Example:

if (Logging.REPORT_LEVEL <= severity) {
Logging.report(Logging.<severity>,
LogChannels.<channel>,
"[meaningful message]");
}
public static final boolean
ASSERT_ENABLED
Flag allowing client code with assert statements to be compiled out of a production build. Clients of the assertion service should wrap calls to the assert() method to enable them to be removed from builds when desired

if (Logging.ASSERT_ENABLED) {
Logging.assertTrue([eval to boolean], "message");
}
public static final boolean
TRACE_ENABLED
Flag to indicate whether tracing is enabled in the Logging service. If the flag is false, calls to the trace() method will have no effect. Callers should use this flag as a type of compile option to remove unnecessary bytecodes from resulting classfiles. For example:
} catch (Throwable t) {
if (Logging.TRACE_ENABLED) {
Logging.trace(t, "[meaningful message]");
}
}
Constructors Summary
Methods Summary
public static voidenableAssert(int enabled)
Enables or disables assertions.

param
enabled > 0 - enable assertions, == 0 - disable it, < 0 - don't change the current setting

    
public static voidenableTrace(int enabled)
Enables or disables tracing.

param
enabled > 0 - enable tracing, == 0 - disable it, < 0 - don't change the current setting

    
public static voidinitLogSettings(int suiteId)
Loads the logging settings for the specified suite.

param
suiteId ID of the suite for which the settings must be loaded


                              
         
    
public static voidsetReportLevel(int newReportLevel)
Sets a new report level.

param
newReportLevel new report level