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 () |
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 | ) |
static Map<String, Object> alma.acs.logging.LogParameterUtil.createPropertiesMap | ( | ) | [static] |
Creates a new special properties map.
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.
name | name of the property | |
defaultValue | value returned if failed to obtain property 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.
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.
name | name of the property | |
defaultValue | value returned if failed to obtain property 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.
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.
logRecord |
References alma.acs.logging.LogParameterUtil.extractSpecialPropertiesMap().
Referenced by alma.acs.logging.LogParameterUtil.LogParameterUtil().
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] |