
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 |
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:
Map are interpreted as name-value pairs and show up in the XML log output as <Data Name="key">value</Data> <Data Name="LoggedParameter">value</Data> Map parameter that contains the key isAcsPropertiesMap. Those values are recognized by the log formatter and result in special fields being set, instead of <Data/> elements being constructed. When adding this map as a log parameter, it should be created using method createPropertiesMap(). 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).
| alma::acs::logging::LogParameterUtil::LogParameterUtil | ( | LogRecord | currentLogRecord | ) | [inline] |
References setCurrentLogRecord().
| static Map<String, Object> alma::acs::logging::LogParameterUtil::createPropertiesMap | ( | ) | [inline, static] |
| long alma::acs::logging::LogParameterUtil::extractLongProperty | ( | String | name, | |
| long | defaultValue | |||
| ) | [inline] |
Extracts property with specified name of type long from the special properties map.
| name | name of the property | |
| defaultValue | value returned if failed to obtain property 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.
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.
| name | name of the property | |
| defaultValue | value returned if failed to obtain property 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.
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.
| logRecord |
References currentLogRecord, extractSpecialPropertiesMap(), otherParameters, and specialProperties.
Referenced by LogParameterUtil().
LogRecord alma::acs::logging::LogParameterUtil::currentLogRecord [private] |
Referenced by extractSpecialPropertiesMap(), and setCurrentLogRecord().
final String alma::acs::logging::LogParameterUtil::IS_ACS_PROPERTIES_MAP_KEYNAME = "isAcsPropertiesMap" [static] |
Referenced by createPropertiesMap(), and extractSpecialPropertiesMap().
List<Object> alma::acs::logging::LogParameterUtil::otherParameters [private] |
Referenced by getNonSpecialPropertiesMapParameters(), and setCurrentLogRecord().
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] |
Map<String, Object> alma::acs::logging::LogParameterUtil::specialProperties [private] |
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().
1.6.2