diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/message/StructuredDataMessage.java b/log4j-api/src/main/java/org/apache/logging/log4j/message/StructuredDataMessage.java index 46b757d54f2..d2c229990fa 100644 --- a/log4j-api/src/main/java/org/apache/logging/log4j/message/StructuredDataMessage.java +++ b/log4j-api/src/main/java/org/apache/logging/log4j/message/StructuredDataMessage.java @@ -58,6 +58,21 @@ public enum Format { /** * Creates a StructuredDataMessage using an ID (max 32 characters), message, and type (max 32 characters). + *

+ * The {@code id} parameter represents the syslog {@code SD-ID} and is expected to conform to + * RFC 5424 Section 6.3.2. + * It is recommended to use {@link StructuredDataId} instead of a raw {@link String} where possible. + *

+ *

+ * The {@code type} parameter represents the syslog {@code MSGID} and is expected to conform to + * RFC 5424 Section 6.2.7. + *

+ *

+ * Both {@code id} and {@code type} are considered trusted inputs (typically compile-time constants). + * If these values are derived from external or untrusted sources, it is the caller's responsibility + * to validate and sanitize them to ensure RFC-compliant output, especially when used with + * {@code Rfc5424Layout}. + *

* @param id The String id. * @param msg The message. * @param type The message type. @@ -69,6 +84,21 @@ public StructuredDataMessage(final String id, final String msg, final String typ /** * Creates a StructuredDataMessage using an ID (user specified max characters), message, and type (user specified * maximum number of characters). + *

+ * The {@code id} parameter represents the syslog {@code SD-ID} and is expected to conform to + * RFC 5424 Section 6.3.2. + * It is recommended to use {@link StructuredDataId} instead of a raw {@link String} where possible. + *

+ *

+ * The {@code type} parameter represents the syslog {@code MSGID} and is expected to conform to + * RFC 5424 Section 6.2.7. + *

+ *

+ * Both {@code id} and {@code type} are considered trusted inputs (typically compile-time constants). + * If these values are derived from external or untrusted sources, it is the caller's responsibility + * to validate and sanitize them to ensure RFC-compliant output, especially when used with + * {@code Rfc5424Layout}. + *

* @param id The String id. * @param msg The message. * @param type The message type. @@ -85,6 +115,21 @@ public StructuredDataMessage(final String id, final String msg, final String typ /** * Creates a StructuredDataMessage using an ID (max 32 characters), message, type (max 32 characters), and an * initial map of structured data to include. + *

+ * The {@code id} parameter represents the syslog {@code SD-ID} and is expected to conform to + * RFC 5424 Section 6.3.2. + * It is recommended to use {@link StructuredDataId} instead of a raw {@link String} where possible. + *

+ *

+ * The {@code type} parameter represents the syslog {@code MSGID} and is expected to conform to + * RFC 5424 Section 6.2.7. + *

+ *

+ * Both {@code id} and {@code type} are considered trusted inputs (typically compile-time constants). + * If these values are derived from external or untrusted sources, it is the caller's responsibility + * to validate and sanitize them to ensure RFC-compliant output, especially when used with + * {@code Rfc5424Layout}. + *

* @param id The String id. * @param msg The message. * @param type The message type. @@ -97,6 +142,21 @@ public StructuredDataMessage(final String id, final String msg, final String typ /** * 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. + *

+ * The {@code id} parameter represents the syslog {@code SD-ID} and is expected to conform to + * RFC 5424 Section 6.3.2. + * It is recommended to use {@link StructuredDataId} instead of a raw {@link String} where possible. + *

+ *

+ * The {@code type} parameter represents the syslog {@code MSGID} and is expected to conform to + * RFC 5424 Section 6.2.7. + *

+ *

+ * Both {@code id} and {@code type} are considered trusted inputs (typically compile-time constants). + * If these values are derived from external or untrusted sources, it is the caller's responsibility + * to validate and sanitize them to ensure RFC-compliant output, especially when used with + * {@code Rfc5424Layout}. + *

* @param id The String id. * @param msg The message. * @param type The message type. @@ -115,6 +175,20 @@ public StructuredDataMessage( /** * Creates a StructuredDataMessage using a StructuredDataId, message, and type (max 32 characters). + *

+ * The {@link StructuredDataId} parameter represents the syslog {@code SD-ID} and is expected to conform to + * RFC 5424 Section 6.3.2. + *

+ *

+ * The {@code type} parameter represents the syslog {@code MSGID} and is expected to conform to + * RFC 5424 Section 6.2.7. + *

+ *

+ * Both {@code id} and {@code type} are considered trusted inputs (typically compile-time constants). + * If these values are derived from external or untrusted sources, it is the caller's responsibility + * to validate and sanitize them to ensure RFC-compliant output, especially when used with + * {@code Rfc5424Layout}. + *

* @param id The StructuredDataId. * @param msg The message. * @param type The message type. @@ -125,6 +199,20 @@ public StructuredDataMessage(final StructuredDataId id, final String msg, final /** * Creates a StructuredDataMessage using a StructuredDataId, message, and type (max 32 characters). + *

+ * The {@link StructuredDataId} parameter represents the syslog {@code SD-ID} and is expected to conform to + * RFC 5424 Section 6.3.2. + *

+ *

+ * The {@code type} parameter represents the syslog {@code MSGID} and is expected to conform to + * RFC 5424 Section 6.2.7. + *

+ *

+ * Both {@code id} and {@code type} are considered trusted inputs (typically compile-time constants). + * If these values are derived from external or untrusted sources, it is the caller's responsibility + * to validate and sanitize them to ensure RFC-compliant output, especially when used with + * {@code Rfc5424Layout}. + *

* @param id The StructuredDataId. * @param msg The message. * @param type The message type. @@ -141,6 +229,20 @@ public StructuredDataMessage(final StructuredDataId id, final String msg, final /** * Creates a StructuredDataMessage using a StructuredDataId, message, type (max 32 characters), and an initial map * of structured data to include. + *

+ * The {@link StructuredDataId} parameter represents the syslog {@code SD-ID} and is expected to conform to + * RFC 5424 Section 6.3.2. + *

+ *

+ * The {@code type} parameter represents the syslog {@code MSGID} and is expected to conform to + * RFC 5424 Section 6.2.7. + *

+ *

+ * Both {@code id} and {@code type} are considered trusted inputs (typically compile-time constants). + * If these values are derived from external or untrusted sources, it is the caller's responsibility + * to validate and sanitize them to ensure RFC-compliant output, especially when used with + * {@code Rfc5424Layout}. + *

* @param id The StructuredDataId. * @param msg The message. * @param type The message type. @@ -154,6 +256,20 @@ public StructuredDataMessage( /** * Creates a StructuredDataMessage using a StructuredDataId, message, type (max 32 characters), and an initial map * of structured data to include. + *

+ * The {@link StructuredDataId} parameter represents the syslog {@code SD-ID} and is expected to conform to + * RFC 5424 Section 6.3.2. + *

+ *

+ * The {@code type} parameter represents the syslog {@code MSGID} and is expected to conform to + * RFC 5424 Section 6.2.7. + *

+ *

+ * Both {@code id} and {@code type} are considered trusted inputs (typically compile-time constants). + * If these values are derived from external or untrusted sources, it is the caller's responsibility + * to validate and sanitize them to ensure RFC-compliant output, especially when used with + * {@code Rfc5424Layout}. + *

* @param id The StructuredDataId. * @param msg The message. * @param type The message type.