Interface RepositoryLogRecord
-
- All Superinterfaces:
- RepositoryLogRecordHeader, java.io.Serializable
public interface RepositoryLogRecord extends RepositoryLogRecordHeader
An individual record in the HPEL repository.Note that both logging requests and tracing requests are represented as RepositoryLogRecords. The java.util.logging package makes no distinction between logging and tracing, and does not differentiate between requests that require localization and those that do not. The RepositoryLogRecord separately keeps track of which requests were successfully localized, and where specified also keeps track of which requests are localizable.
Many of the RepositoryLogRecord's fields are modeled after identically named fields in the java.util.logging.LogRecord class:
getLevel
getLoggerName
getMillis
getParameters
getResourceBundleName
getThreadID
getSourceClassName
getSourceMethodName
getThreadID
The RepositoryLogRecord also keeps track of additional information as explained in the method detail.
Fields related to re-localization:
The RepositoryLogRecord makes re-localization (retranslating a log to another language using an alternate locale's resource bundles) of messages possible by storing the raw message. The localizable field helps improve message formatting efficiency by providing a hint to formatters about which requests localization is required for.
The message locale field is also helpful for re-localization cases as it contains the locale name used during the runtime localization of the localized message, which can be used to verify if the formatted message was already localized in the target locale.
Note that for needs not related to re-localization, the formatted message is the most useful representation of the message, and mimics the java.util.logging.LogRecord's
LogRecord.getMessage()
behavior.
-
-
Field Summary
Fields Modifier and Type Field and Description static java.lang.String
COMPONENT
static java.lang.String
CORRELATIONID
static int
DEFAULT_LOCALIZATION
static java.lang.String
ORBREQUESTID
static java.lang.String
ORGANIZATION
static java.lang.String
PRODUCT
static java.lang.String
PTHREADID
static int
REQUIRES_LOCALIZATION
static int
REQUIRES_NO_LOCALIZATION
-
Method Summary
Methods Modifier and Type Method and Description java.lang.String
getExtension(java.lang.String name)
Returns an extended value associated with this record.java.util.Map<java.lang.String,java.lang.String>
getExtensions()
Returns the entire set of extended values associated with this record.java.lang.String
getFormattedMessage()
Returns the formatted version of the record with any place holder parameters substituted with values.int
getLocalizable()
Returns an indicator of whether or not this record is localizable.java.lang.String
getLocalizedMessage()
Returns the localized version of the raw message if localization was attempted and successful.java.lang.String
getLoggerName()
Returns the name of the logger that created this record.java.lang.String
getMessageID()
Returns the IBM Message ID of the record's message.java.lang.String
getMessageLocale()
Returns the locale used for message localization.java.lang.Object[]
getParameters()
Returns values for the positional parameters in the record's message.byte[]
getRawData()
Returns any raw data associated with this record.java.lang.String
getRawMessage()
Returns the raw message text as it was supplied in the call to the logger.java.lang.String
getResourceBundleName()
Returns the resource bundle name associated with this record.long
getSequence()
Returns the sequence index of the message as generated by the logger.java.lang.String
getSourceClassName()
Returns the name of the class that made the call to the logger.java.lang.String
getSourceMethodName()
Returns the name of the method that made the call to the logger.java.lang.String
getStackTrace()
Returns the stack trace if this record was generated due to an exception.-
Methods inherited from interface com.ibm.websphere.logging.hpel.reader.RepositoryLogRecordHeader
getLevel, getMillis, getRepositoryPointer, getThreadID
-
-
-
-
Field Detail
-
PTHREADID
static final java.lang.String PTHREADID
- See Also:
- Constant Field Values
-
COMPONENT
static final java.lang.String COMPONENT
- See Also:
- Constant Field Values
-
CORRELATIONID
static final java.lang.String CORRELATIONID
- See Also:
- Constant Field Values
-
ORBREQUESTID
static final java.lang.String ORBREQUESTID
- See Also:
- Constant Field Values
-
ORGANIZATION
static final java.lang.String ORGANIZATION
- See Also:
- Constant Field Values
-
PRODUCT
static final java.lang.String PRODUCT
- See Also:
- Constant Field Values
-
DEFAULT_LOCALIZATION
static final int DEFAULT_LOCALIZATION
- See Also:
- Constant Field Values
-
REQUIRES_LOCALIZATION
static final int REQUIRES_LOCALIZATION
- See Also:
- Constant Field Values
-
REQUIRES_NO_LOCALIZATION
static final int REQUIRES_NO_LOCALIZATION
- See Also:
- Constant Field Values
-
-
Method Detail
-
getLoggerName
java.lang.String getLoggerName()
Returns the name of the logger that created this record.- Returns:
- the loggerName attribute value.
- See Also:
LogRecord.getLoggerName()
-
getMessageID
java.lang.String getMessageID()
Returns the IBM Message ID of the record's message.The IBM Message ID is the unique identifier of this message across IBM software products. This message ID is the same regardless of what locale the message is rendered in.
For non-message records, and for other messages that do not begin with a message ID this method returns
null
.- Returns:
- the message ID or
null
if there is no message ID.
-
getRawMessage
java.lang.String getRawMessage()
Returns the raw message text as it was supplied in the call to the logger.- Returns:
- the raw message.
-
getFormattedMessage
java.lang.String getFormattedMessage()
Returns the formatted version of the record with any place holder parameters substituted with values.In cases where the localized message is not null, the formatted message is the localized message with any place holder values filled in with corresponding parameter values.
In cases where the localized message is null, the formatted message is the raw message with any place holder values filled in with corresponding parameter values.
This is the same behavior as found in
LogRecord.getMessage()
- Returns:
- the fully localized and formatted message.
- See Also:
getRawMessage()
,getLocalizedMessage()
,LogRecord.getMessage()
-
getLocalizedMessage
java.lang.String getLocalizedMessage()
Returns the localized version of the raw message if localization was attempted and successful.In cases where the raw message is localizable, and localization is successful, the localized message is the value looked up from the associated resource bundle in the associated locale using the raw message as the key.
In cases where the raw message is localizable, and localization fails, the localized message is null.
In cases where the raw message is not localizable, the localized message is null.
Note that, in contrast to the formatted message, the localized message does NOT have its place holder values (if any) filled in with parameter values.
- Returns:
- the localized message or
null
if no localization is necessary or localization failed. - See Also:
getMessageLocale()
-
getMessageLocale
java.lang.String getMessageLocale()
Returns the locale used for message localization.In cases where the raw message is localizable, and localization is successful, the locale is the locale used by the runtime for localization.
In cases where the raw message is localizable, and localization fails, the locale is null.
In cases where the raw message is not localizable, the locale is null.
- Returns:
- the message locale or
null
if localization was not required for this record or failed at runtime.
-
getResourceBundleName
java.lang.String getResourceBundleName()
Returns the resource bundle name associated with this record.Resource bundles typically contain the locale specific version of the raw message.
- Returns:
- the resource bundle name or
null
if message does not require translation. - See Also:
LogRecord.getResourceBundleName()
-
getParameters
java.lang.Object[] getParameters()
Returns values for the positional parameters in the record's message.- Returns:
- the parameters.
- See Also:
LogRecord.getParameters()
-
getSequence
long getSequence()
Returns the sequence index of the message as generated by the logger.- Returns:
- the sequence index.
-
getSourceClassName
java.lang.String getSourceClassName()
Returns the name of the class that made the call to the logger. Note that this may be the name of the source class supplied in the call to the logger, or may be an inferred source class name, and is not guaranteed to be accurate.- Returns:
- the source class name.
- See Also:
LogRecord.getSourceClassName()
-
getSourceMethodName
java.lang.String getSourceMethodName()
Returns the name of the method that made the call to the logger. Note that this may be the name of the source method supplied in the call to the logger, or may be an inferred source method name, and is not guaranteed to be accurate.- Returns:
- the source method name.
- See Also:
LogRecord.getSourceMethodName()
-
getStackTrace
java.lang.String getStackTrace()
Returns the stack trace if this record was generated due to an exception. The stack trace is only computed for records where a throwable was supplied by the caller explicitly.- Returns:
- the stack trace or
null
if message does not have a stack trace associated with it.
-
getExtensions
java.util.Map<java.lang.String,java.lang.String> getExtensions()
Returns the entire set of extended values associated with this record.Extensions may be added to a record by the logger via the Logger.properties extension mechanism, or may be added to the record by the logging runtime which uses extensions for other fields (see extension constants).
Extensions from the HPEL
LogRecordContext
are also added to the record by the HPEL handlers.- Returns:
- the extensions.
-
getExtension
java.lang.String getExtension(java.lang.String name)
Returns an extended value associated with this record.This is effectively returning
getExtensions().get(name)
- Parameters:
name
- the extension's name.- Returns:
- the specified extension.
-
getLocalizable
int getLocalizable()
Returns an indicator of whether or not this record is localizable.This field is generally set via the Logger.properties file using the minimum_localization_level attribute. The Logger.properties file is an extension to the java.util.logging API.
The indicator will be one of the following values:
DEFAULT_LOCALIZATION where no information was supplied by the logger as to the localizability of this record.
REQUIRES_LOCALIZATION where the record is localizable.
REQUIRES_NO_LOCALIZATION where the record is not localizable.
- Returns:
- the localizable attribute value.
-
getRawData
byte[] getRawData()
Returns any raw data associated with this record.- Returns:
- the rawData attribute value.
-
-