Class TextFormattedLogMessage
java.lang.Object
com.unboundid.ldap.sdk.unboundidds.logs.v2.text.TextFormattedLogMessage
- All Implemented Interfaces:
LogMessage,Serializable
- Direct Known Subclasses:
TextFormattedAccessLogMessage
@NotExtensible
@NotMutable
@ThreadSafety(level=INTERFACE_THREADSAFE)
public class TextFormattedLogMessage
extends Object
implements LogMessage
This class provides a data structure that holds information about a
text-formatted log message in the name=value format used by the Ping
Identity Directory Server and related server products.
NOTE: This class, and other classes within the
com.unboundid.ldap.sdk.unboundidds package structure, are only
supported for use against Ping Identity, UnboundID, and
Nokia/Alcatel-Lucent 8661 server products. These classes provide support
for proprietary functionality or for external specifications that are not
considered stable or mature enough to be guaranteed to work in an
interoperable way with other types of LDAP servers.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final StringA predefined string that will be used if a field exists in a log message with just a value but no field name. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCreates a new text-formatted log message from the provided parsed message.TextFormattedLogMessage(String logMessageString) Creates a new text-formatted log message from the provided string. -
Method Summary
Modifier and TypeMethodDescriptionfinal BooleangetBoolean(LogField logField) Retrieves the value of the specified field as aBooleanobject.final DoubleRetrieves the value of the specified field as aDoublevalue.Retrieves a map of the fields and their corresponding values in this log message.final DategetGeneralizedTime(LogField logField) Retrieves the value of the specified field as aDateobject decoded from the generalized time format.final IntegergetInteger(LogField logField) Retrieves the value of the specified field as anIntegervalue.final LongRetrieves the value of the specified field as aLongvalue.final DategetRFC3339Timestamp(LogField logField) Retrieves the value of the specified field as aDateobject decoded from the ISO 8601 format described in RFC 3339.final StringRetrieves the value of the specified field as a string.final DateRetrieves the timestamp for this log message.final StringtoString()Retrieves a string representation of this log message.
-
Field Details
-
NO_FIELD_NAME
A predefined string that will be used if a field exists in a log message with just a value but no field name.- See Also:
-
-
Constructor Details
-
TextFormattedLogMessage
Creates a new text-formatted log message from the provided parsed message.- Parameters:
message- The message to use to create this log message. It must not benull.
-
TextFormattedLogMessage
Creates a new text-formatted log message from the provided string.- Parameters:
logMessageString- The string representation of this log message. It must not benull.- Throws:
LogException- If the provided string cannot be parsed as a valid text-formatted log message.
-
-
Method Details
-
getTimestamp
Retrieves the timestamp for this log message.- Specified by:
getTimestampin interfaceLogMessage- Returns:
- The timestamp for this log message.
-
getFields
Retrieves a map of the fields and their corresponding values in this log message.- Specified by:
getFieldsin interfaceLogMessage- Returns:
- A map of the fields and their corresponding values in this log message.
-
getBoolean
Retrieves the value of the specified field as aBooleanobject. If the field has multiple values, the first will be returned.- Specified by:
getBooleanin interfaceLogMessage- Parameters:
logField- The field for which to retrieve the Boolean value.- Returns:
- The value of the specified field as a
Booleanobject, ornullif the log message does not have the specified field. - Throws:
LogException- If the value of the specified field cannot be parsed as a Boolean.
-
getGeneralizedTime
Retrieves the value of the specified field as aDateobject decoded from the generalized time format. If the field has multiple values, the first will be returned.- Specified by:
getGeneralizedTimein interfaceLogMessage- Parameters:
logField- The field for which to retrieve the timestamp value.- Returns:
- The value of the specified field as a
Dateobject, ornullif the log message does not have the specified field. - Throws:
LogException- If the value of the specified field cannot be parsed as aDatein the generalized time format.
-
getDouble
Retrieves the value of the specified field as aDoublevalue. If the field has multiple values, the first will be returned.- Specified by:
getDoublein interfaceLogMessage- Parameters:
logField- The field for which to retrieve theDoublevalue.- Returns:
- The value of the specified field as a
Doublevalue, ornullif the log message does not have the specified field. - Throws:
LogException- If the value of the specified field cannot be parsed as aDouble.
-
getInteger
Retrieves the value of the specified field as anIntegervalue. If the field has multiple values, the first will be returned.- Specified by:
getIntegerin interfaceLogMessage- Parameters:
logField- The field for which to retrieve theIntegervalue.- Returns:
- The
Integervalue of the specified field, ornullif the log message does not have the specified field. - Throws:
LogException- If the value of the specified field cannot be parsed as anInteger.
-
getLong
Retrieves the value of the specified field as aLongvalue. If the field has multiple values, the first will be returned.- Specified by:
getLongin interfaceLogMessage- Parameters:
logField- The field for which to retrieve theLongvalue.- Returns:
- The
Longvalue of the specified field, ornullif the log message does not have the specified field. - Throws:
LogException- If the value of the specified field cannot be parsed as aLong.
-
getRFC3339Timestamp
Retrieves the value of the specified field as aDateobject decoded from the ISO 8601 format described in RFC 3339. If the field has multiple values, the first will be returned.- Specified by:
getRFC3339Timestampin interfaceLogMessage- Parameters:
logField- The field for which to retrieve the timestamp value.- Returns:
- The value of the specified field as a
Dateobject, ornullif the log message does not have the specified field. - Throws:
LogException- If the value of the specified field cannot be parsed as aDatein the RFC 3339 format.
-
getString
Retrieves the value of the specified field as a string. If the field has multiple values, the first will be returned.- Specified by:
getStringin interfaceLogMessage- Parameters:
logField- The field for which to retrieve the string value.- Returns:
- The value of the specified field as a string, or
nullif the log message does not have the specified field.
-
toString
Retrieves a string representation of this log message.- Specified by:
toStringin interfaceLogMessage- Overrides:
toStringin classObject- Returns:
- A string representation of this log message.
-