LOG4J2-1858 make the MAX_REUSABLE_MESSAGE_SIZE available in log4j-api's Constants class
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/a903427c Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/a903427c Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/a903427c Branch: refs/heads/master Commit: a903427c5f373e476736a07f259afb463a7001fd Parents: f1b71ea Author: rpopma <rpo...@apache.org> Authored: Sun Apr 16 16:50:25 2017 +0900 Committer: rpopma <rpo...@apache.org> Committed: Sun Apr 16 16:50:25 2017 +0900 ---------------------------------------------------------------------- .../org/apache/logging/log4j/util/Constants.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/a903427c/log4j-api/src/main/java/org/apache/logging/log4j/util/Constants.java ---------------------------------------------------------------------- diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/util/Constants.java b/log4j-api/src/main/java/org/apache/logging/log4j/util/Constants.java index ab300bf..c20d446 100644 --- a/log4j-api/src/main/java/org/apache/logging/log4j/util/Constants.java +++ b/log4j-api/src/main/java/org/apache/logging/log4j/util/Constants.java @@ -43,6 +43,21 @@ public final class Constants { public static final int JAVA_MAJOR_VERSION = getMajorVersion(); /** + * Maximum size of the StringBuilders used in RingBuffer LogEvents to store the contents of reusable Messages. + * After a large message has been delivered to the appenders, the StringBuilder is trimmed to this size. + * <p> + * The default value is {@value}, which allows the StringBuilder to resize three times from its initial size. + * Users can override with system property "log4j.maxReusableMsgSize". + * </p> + * @since 2.9 + */ + public static final int MAX_REUSABLE_MESSAGE_SIZE = size("log4j.maxReusableMsgSize", (128 * 2 + 2) * 2 + 2); + + private static int size(final String property, final int defaultValue) { + return PropertiesUtil.getProperties().getIntegerProperty(property, defaultValue); + } + + /** * Determines if a named Class can be loaded or not. * * @param className The class name.