alma::acs::logging::LogParameterUtil Class Reference

Collaboration diagram for alma::acs::logging::LogParameterUtil:
Collaboration graph
[legend]

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 ()

Private Attributes

LogRecord currentLogRecord
Map< String, Object > specialProperties
List< Object > otherParameters

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  )  [inline]

References setCurrentLogRecord().


Member Function Documentation

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

Creates a new special properties map.

Returns:

References IS_ACS_PROPERTIES_MAP_KEYNAME.

long alma::acs::logging::LogParameterUtil::extractLongProperty ( String  name,
long  defaultValue 
) [inline]

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

References specialProperties.

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

Map<String, Object> alma::acs::logging::LogParameterUtil::extractSpecialPropertiesMap (  )  [inline, 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 currentLogRecord, IS_ACS_PROPERTIES_MAP_KEYNAME, and specialProperties.

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

String alma::acs::logging::LogParameterUtil::extractStringProperty ( String  name,
String  defaultValue 
) [inline]

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

References specialProperties.

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

List<Object> alma::acs::logging::LogParameterUtil::getNonSpecialPropertiesMapParameters (  )  [inline]

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.

References otherParameters.

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  )  [inline]

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

Parameters:
logRecord 

References currentLogRecord, extractSpecialPropertiesMap(), otherParameters, and specialProperties.

Referenced by 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]

A Mapthat is used as an optional special log parameter. It transports information from the application to the log formatter which could otherwise not be transported using the JDK's LogRecord.

Referenced by extractLongProperty(), extractSpecialPropertiesMap(), extractStringProperty(), and setCurrentLogRecord().


The documentation for this class was generated from the following file:

Generated by  doxygen 1.6.2