Tracing and Logging

Trace-level logging is used to log message that are useful in tracing the behaviour of the system by logging WHAT the system does. This type of logging can be enabled/disabled using system configurable parameters in the property files.

The pattern for enabling trace-level logging is as follows:

Declare a protected boolean value that is set based on a system configurable parameter with a key name using the following convention <class name> + ‘.trace’. For example, in the FSecurityManager.javva:

protected boolean trace =  FPropertyManager.getBoolProperty(“FSecurityManager.trace”);

Notice that the trace flag is set in a non-static. This is necessary as (eventually) we want to be able to enable/disable this capability without having to restart the system.

Subsequently, individual trace messages can be logged using the following approach:

if (trace) {
FLogger.showInfo(this, “Opening session for user ” + fUserCode +
” on workstation ” + fWorkstationCode +
” using session event manager ” +
fSessionEventManager);
}

Debug-level logging is used to log very detailed messages that are only of relevant to the programmer. These are not runtime-enableable/configurable.  Simple comment out the log messages after you are done debugging, but leave them in your code in case you need to debug in the future.

//FLogger.showDebug(null, “Encoded map image ” + image + ” to ” +
// byteAry.length + ” bytes in ” + duration + “
ms.”);

This documentation has now been added to the Developers Guide.