LOG4J2-1343 Added Constants.ENABLE_DIRECT_ENCODERS kill switch for the garbage-free Layout mechanism
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/a95eeb85 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/a95eeb85 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/a95eeb85 Branch: refs/heads/LOG4J2-1356 Commit: a95eeb85db063e2e061a3152aa41924563291d82 Parents: b60bf6f Author: rpopma <[email protected]> Authored: Thu Apr 7 02:52:34 2016 +0900 Committer: rpopma <[email protected]> Committed: Thu Apr 7 02:52:34 2016 +0900 ---------------------------------------------------------------------- .../org/apache/logging/log4j/core/util/Constants.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/a95eeb85/log4j-core/src/main/java/org/apache/logging/log4j/core/util/Constants.java ---------------------------------------------------------------------- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/Constants.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/Constants.java index 6cd0e8a..dd1cd27 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/Constants.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/Constants.java @@ -72,7 +72,7 @@ public final class Constants { "log4j.format.msg.async", false); /** - * {@code true} if we think we are running in a web container, base on the boolean value of system property + * {@code true} if we think we are running in a web container, based on the boolean value of system property * "log4j2.is.webapp", or (if this system property is not set) whether the {@code javax.servlet.Servlet} class * is present in the classpath. */ @@ -91,6 +91,18 @@ public final class Constants { "log4j2.enable.threadlocals", true); /** + * Kill switch for garbage-free Layout behaviour that encodes LogEvents directly into + * {@link org.apache.logging.log4j.core.layout.ByteBufferDestination}s without creating intermediate temporary + * Objects. + * <p> + * {@code True} by default, disable by setting system property "log4j2.enable.direct.encoders" to "false". + * + * @since 2.6 + */ + public static final boolean ENABLE_DIRECT_ENCODERS = PropertiesUtil.getProperties().getBooleanProperty( + "log4j2.enable.direct.encoders", true); + + /** * Prevent class instantiation. */ private Constants() {
