Public Member Functions | Static Public Member Functions | Static Public Attributes | Package Functions

alma.acs.logging.LogParameterUtil Class Reference

List of all members.

Public Member Functions

 LogParameterUtil (LogRecord currentLogRecord)
void setCurrentLogRecord (LogRecord logRecord)
List< Object > getNonSpecialPropertiesMapParameters ()
long extractLongProperty (String name, long defaultValue)
String extractStringProperty (String name, String defaultValue)

Static Public Member Functions

static Map< String, Object > createPropertiesMap ()

Static Public Attributes

static final String IS_ACS_PROPERTIES_MAP_KEYNAME = "isAcsPropertiesMap"
static final String PARAM_THREAD_NAME = "ThreadName"
static final String PARAM_LINE = "Line"
static final String PARAM_HOSTNAME = "HostName"
static final String PARAM_STACK_ID = "StackId"
static final String PARAM_STACK_LEVEL = "StackLevel"
static final String PARAM_PRIORITY = "Priority"
static final String PARAM_URI = "Uri"
static final String PARAM_PROCESSNAME = "ProcessName"
static final String PARAM_SOURCEOBJECT = "SourceObject"

Package Functions

Map< String, Object > extractSpecialPropertiesMap ()

Detailed Description

Class that encapsulates access to log record parameters, and handling of a special Property-Map parameter. Some conventions are necessary because we "smuggle" some extra information from the plain-JDK loggers to the ACS-aware log dispatcher. The alternative would be to expose ACS custom loggers to applications, which seems too ugly for the benefit it provides.

The rules are:

Note that this class is stateful: returned values come from the last given LogRecord, which can be set in the constructor or overwritten in setCurrentLogRecord(LogRecord).


Constructor & Destructor Documentation

alma.acs.logging.LogParameterUtil.LogParameterUtil ( LogRecord  currentLogRecord  ) 

Member Function Documentation

static Map<String, Object> alma.acs.logging.LogParameterUtil.createPropertiesMap (  )  [static]

Creates a new special properties map.

Returns:

References alma.acs.logging.LogParameterUtil.IS_ACS_PROPERTIES_MAP_KEYNAME.

long alma.acs.logging.LogParameterUtil.extractLongProperty ( String  name,
long  defaultValue 
)

Extracts property with specified name of type long from the special properties map.

Parameters:
name name of the property
defaultValue value returned if failed to obtain property value
Returns:
value, defaultValue on failure

Referenced by alma.acs.logging.formatters.AcsXMLLogFormatter.format(), and alma.acs.logging.formatters.AcsBinLogFormatter.formatBinary().

Map<String, Object> alma.acs.logging.LogParameterUtil.extractSpecialPropertiesMap (  )  [package]

Tries to find the special properties map among the log parameters.

Returns:
the existing properties map from the current log record, or null if none is found.

References alma.acs.logging.LogParameterUtil.IS_ACS_PROPERTIES_MAP_KEYNAME.

Referenced by alma.acs.logging.AcsLogger.log(), and alma.acs.logging.LogParameterUtil.setCurrentLogRecord().

String alma.acs.logging.LogParameterUtil.extractStringProperty ( String  name,
String  defaultValue 
)

Extracts property with specified name of type String from the special properties map.

Parameters:
name name of the property
defaultValue value returned if failed to obtain property value
Returns:
value, defaultValue on failure

Referenced by alma.acs.logging.formatters.AcsXMLLogFormatter.format(), and alma.acs.logging.formatters.AcsBinLogFormatter.formatBinary().

List<Object> alma.acs.logging.LogParameterUtil.getNonSpecialPropertiesMapParameters (  ) 

Returns parameters of the current log record which are different from the special Properties Map. These parameters may still be of type Map.

The returned list is "live", so don't muck with it.

Returns:
array of parameters, possibly empty, but never null.

Referenced by alma.acs.logging.formatters.ConsoleLogFormatter.format(), alma.acs.logging.formatters.AcsXMLLogFormatter.format(), alma.acs.logging.formatters.AcsBinLogFormatter.formatBinary(), and alma.acs.logging.AcsLogger.log().

void alma.acs.logging.LogParameterUtil.setCurrentLogRecord ( LogRecord  logRecord  ) 

Sets the log record from which the other methods can extract information. Also parses the special properties map and other parameters.

Parameters:
logRecord 

References alma.acs.logging.LogParameterUtil.extractSpecialPropertiesMap().

Referenced by alma.acs.logging.LogParameterUtil.LogParameterUtil().


Member Data Documentation

final String alma.acs.logging.LogParameterUtil.IS_ACS_PROPERTIES_MAP_KEYNAME = "isAcsPropertiesMap" [static]
final String alma.acs.logging.LogParameterUtil.PARAM_HOSTNAME = "HostName" [static]
final String alma.acs.logging.LogParameterUtil.PARAM_LINE = "Line" [static]
final String alma.acs.logging.LogParameterUtil.PARAM_PRIORITY = "Priority" [static]
final String alma.acs.logging.LogParameterUtil.PARAM_PROCESSNAME = "ProcessName" [static]
final String alma.acs.logging.LogParameterUtil.PARAM_SOURCEOBJECT = "SourceObject" [static]
final String alma.acs.logging.LogParameterUtil.PARAM_STACK_ID = "StackId" [static]
final String alma.acs.logging.LogParameterUtil.PARAM_STACK_LEVEL = "StackLevel" [static]
final String alma.acs.logging.LogParameterUtil.PARAM_THREAD_NAME = "ThreadName" [static]
final String alma.acs.logging.LogParameterUtil.PARAM_URI = "Uri" [static]

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Enumerations Properties