Repository: logging-log4j2 Updated Branches: refs/heads/master 893ead0f4 -> 3c63ba7b9
More Javadoc. Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/3c63ba7b Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/3c63ba7b Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/3c63ba7b Branch: refs/heads/master Commit: 3c63ba7b9b1954317556f51943a285e338647d82 Parents: 893ead0 Author: Gary Gregory <[email protected]> Authored: Thu Jun 1 11:18:59 2017 -0700 Committer: Gary Gregory <[email protected]> Committed: Thu Jun 1 11:18:59 2017 -0700 ---------------------------------------------------------------------- .../logging/log4j/message/MapMessage.java | 29 ++++++++++++++++---- 1 file changed, 23 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/3c63ba7b/log4j-api/src/main/java/org/apache/logging/log4j/message/MapMessage.java ---------------------------------------------------------------------- diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/message/MapMessage.java b/log4j-api/src/main/java/org/apache/logging/log4j/message/MapMessage.java index 05c613e..b0dbca7 100644 --- a/log4j-api/src/main/java/org/apache/logging/log4j/message/MapMessage.java +++ b/log4j-api/src/main/java/org/apache/logging/log4j/message/MapMessage.java @@ -39,6 +39,7 @@ import org.apache.logging.log4j.util.TriConsumer; * 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. + * </p> */ @PerformanceSensitive("allocation") @AsynchronouslyFormattable @@ -48,10 +49,13 @@ public class MapMessage implements MultiformatMessage, StringBuilderFormattable * When set as the format specifier causes the Map to be formatted as XML. */ public enum MapFormat { + /** The map should be formatted as XML. */ XML, + /** The map should be formatted as JSON. */ JSON, + /** The map should be formatted the same as documented by java.util.AbstractMap.toString(). */ JAVA; @@ -210,7 +214,7 @@ public class MapMessage implements MultiformatMessage, StringBuilderFormattable } /** - * Formats the Structured data as described in RFC 5424. + * Formats the Structured data as described in <a href="https://tools.ietf.org/html/rfc5424">RFC 5424</a>. * * @return The formatted String. */ @@ -218,6 +222,12 @@ public class MapMessage implements MultiformatMessage, StringBuilderFormattable return format((MapFormat) null, new StringBuilder()).toString(); } + /** + * Formats the Structured data as described in <a href="https://tools.ietf.org/html/rfc5424">RFC 5424</a>. + * + * @param format The format identifier. + * @return The formatted String. + */ public String asString(final String format) { try { return format(EnglishEnums.valueOf(MapFormat.class, format), new StringBuilder()).toString(); @@ -278,9 +288,9 @@ public class MapMessage implements MultiformatMessage, StringBuilderFormattable } /** - * Formats the Structured data as described in RFC 5424. + * Formats the Structured data as described in <a href="https://tools.ietf.org/html/rfc5424">RFC 5424</a>. * - * @param format The format identifier. Ignored in this implementation. + * @param format The format identifier. * @return The formatted String. */ private StringBuilder format(final MapFormat format, final StringBuilder sb) { @@ -308,6 +318,11 @@ public class MapMessage implements MultiformatMessage, StringBuilderFormattable return sb; } + /** + * Formats this message as an XML fragment String into the given builder. + * + * @param sb format into this builder. + */ public void asXml(final StringBuilder sb) { sb.append("<Map>\n"); for (int i = 0; i < data.size(); i++) { @@ -328,9 +343,11 @@ public class MapMessage implements MultiformatMessage, StringBuilderFormattable /** * - * @param formats An array of Strings that provide extra information about how to format the message. - * MapMessage uses the first format specifier it recognizes. The supported formats are XML, JSON, and - * JAVA. The default format is key1="value1" key2="value2" as required by RFC 5424 messages. + * @param formats + * An array of Strings that provide extra information about how to format the message. MapMessage uses + * the first format specifier it recognizes. The supported formats are XML, JSON, and JAVA. The default + * format is key1="value1" key2="value2" as required by <a href="https://tools.ietf.org/html/rfc5424">RFC + * 5424</a> messages. * * @return The formatted message. */
