Class StructuredDataMessage

java.lang.Object
org.apache.logging.log4j.message.MapMessage<StructuredDataMessage,String>
org.apache.logging.log4j.message.StructuredDataMessage
All Implemented Interfaces:
Serializable, Message, MultiformatMessage, MultiFormatStringBuilderFormattable, StringBuilderFormattable

@AsynchronouslyFormattable public class StructuredDataMessage extends MapMessage<StructuredDataMessage,String>
Represents a Message that conforms to an RFC 5424 StructuredData element along with the syslog message.

Thread-safety note: the contents of this message can be modified after construction. When using asynchronous loggers and appenders it is not recommended to modify this message after the message is logged, because it is undefined whether the logged message string will contain the old values or the modified values.

See Also:
  • Constructor Details

    • StructuredDataMessage

      public StructuredDataMessage(String id, String msg, String type)
      Creates a StructuredDataMessage using an ID (max 32 characters), message, and type (max 32 characters).
      Parameters:
      id - The String id.
      msg - The message.
      type - The message type.
    • StructuredDataMessage

      public StructuredDataMessage(String id, String msg, String type, int maxLength)
      Creates a StructuredDataMessage using an ID (user specified max characters), message, and type (user specified maximum number of characters).
      Parameters:
      id - The String id.
      msg - The message.
      type - The message type.
      maxLength - The maximum length of keys;
      Since:
      2.9
    • StructuredDataMessage

      public StructuredDataMessage(String id, String msg, String type, Map<String,String> data)
      Creates a StructuredDataMessage using an ID (max 32 characters), message, type (max 32 characters), and an initial map of structured data to include.
      Parameters:
      id - The String id.
      msg - The message.
      type - The message type.
      data - The StructuredData map.
    • StructuredDataMessage

      public StructuredDataMessage(String id, String msg, String type, Map<String,String> data, int maxLength)
      Creates a StructuredDataMessage using an (user specified max characters), message, and type (user specified maximum number of characters, and an initial map of structured data to include.
      Parameters:
      id - The String id.
      msg - The message.
      type - The message type.
      data - The StructuredData map.
      maxLength - The maximum length of keys;
      Since:
      2.9
    • StructuredDataMessage

      public StructuredDataMessage(StructuredDataId id, String msg, String type)
      Creates a StructuredDataMessage using a StructuredDataId, message, and type (max 32 characters).
      Parameters:
      id - The StructuredDataId.
      msg - The message.
      type - The message type.
    • StructuredDataMessage

      public StructuredDataMessage(StructuredDataId id, String msg, String type, int maxLength)
      Creates a StructuredDataMessage using a StructuredDataId, message, and type (max 32 characters).
      Parameters:
      id - The StructuredDataId.
      msg - The message.
      type - The message type.
      maxLength - The maximum length of keys;
      Since:
      2.9
    • StructuredDataMessage

      public StructuredDataMessage(StructuredDataId id, String msg, String type, Map<String,String> data)
      Creates a StructuredDataMessage using a StructuredDataId, message, type (max 32 characters), and an initial map of structured data to include.
      Parameters:
      id - The StructuredDataId.
      msg - The message.
      type - The message type.
      data - The StructuredData map.
    • StructuredDataMessage

      public StructuredDataMessage(StructuredDataId id, String msg, String type, Map<String,String> data, int maxLength)
      Creates a StructuredDataMessage using a StructuredDataId, message, type (max 32 characters), and an initial map of structured data to include.
      Parameters:
      id - The StructuredDataId.
      msg - The message.
      type - The message type.
      data - The StructuredData map.
      maxLength - The maximum length of keys;
      Since:
      2.9
    • StructuredDataMessage

      protected StructuredDataMessage()
      Basic constructor.
  • Method Details