You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by ma...@apache.org on 2016/06/18 20:09:13 UTC
[07/26] logging-log4j2 git commit: Refactor magic number into a
constant. Should this be configurable?
Refactor magic number into a constant. Should this be configurable?
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/906f5109
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/906f5109
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/906f5109
Branch: refs/heads/feature/LOG4J2-1430
Commit: 906f5109f7b27ed1b5403297c29e3a5296aa063d
Parents: f1b41d0
Author: ggregory <gg...@apache.org>
Authored: Thu Jun 16 15:50:40 2016 -0700
Committer: ggregory <gg...@apache.org>
Committed: Thu Jun 16 15:50:40 2016 -0700
----------------------------------------------------------------------
.../org/apache/logging/log4j/message/ParameterizedMessage.java | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/906f5109/log4j-api/src/main/java/org/apache/logging/log4j/message/ParameterizedMessage.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/message/ParameterizedMessage.java b/log4j-api/src/main/java/org/apache/logging/log4j/message/ParameterizedMessage.java
index c48ab14..d9b9ea5 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/message/ParameterizedMessage.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/message/ParameterizedMessage.java
@@ -29,6 +29,10 @@ import org.apache.logging.log4j.util.StringBuilderFormattable;
* </p>
*/
public class ParameterizedMessage implements Message, StringBuilderFormattable {
+
+ // Should this be configurable?
+ private static final int DEFAULT_STRING_BUILDER_SIZE = 255;
+
/**
* Prefix for recursion.
*/
@@ -199,7 +203,7 @@ public class ParameterizedMessage implements Message, StringBuilderFormattable {
private static StringBuilder getThreadLocalStringBuilder() {
StringBuilder buffer = threadLocalStringBuilder.get();
if (buffer == null) {
- buffer = new StringBuilder(255);
+ buffer = new StringBuilder(DEFAULT_STRING_BUILDER_SIZE);
threadLocalStringBuilder.set(buffer);
}
buffer.setLength(0);