You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by rp...@apache.org on 2016/02/14 11:57:57 UTC
[1/2] logging-log4j2 git commit: small performance improvement:
shortcut to skip FormattingInfo if it is the no-op default instance
Repository: logging-log4j2
Updated Branches:
refs/heads/master 09748f9ab -> e07c41fc7
small performance improvement: shortcut to skip FormattingInfo if it is the no-op default instance
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/9898972e
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/9898972e
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/9898972e
Branch: refs/heads/master
Commit: 9898972e46a217a70ecc1b11686999fe12b04018
Parents: 66ec0ca
Author: rpopma <rp...@apache.org>
Authored: Sun Feb 14 19:57:39 2016 +0900
Committer: rpopma <rp...@apache.org>
Committed: Sun Feb 14 19:57:39 2016 +0900
----------------------------------------------------------------------
.../apache/logging/log4j/core/pattern/PatternFormatter.java | 9 +++++++++
1 file changed, 9 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/9898972e/log4j-core/src/main/java/org/apache/logging/log4j/core/pattern/PatternFormatter.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/pattern/PatternFormatter.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/pattern/PatternFormatter.java
index 014a1ed..4bde1e2 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/pattern/PatternFormatter.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/pattern/PatternFormatter.java
@@ -25,13 +25,22 @@ import org.apache.logging.log4j.core.LogEvent;
public class PatternFormatter {
private final LogEventPatternConverter converter;
private final FormattingInfo field;
+ private final boolean skipFormattingInfo;
public PatternFormatter(final LogEventPatternConverter converter, final FormattingInfo field) {
this.converter = converter;
this.field = field;
+ this.skipFormattingInfo = field == FormattingInfo.getDefault();
}
public void format(final LogEvent event, final StringBuilder buf) {
+ if (skipFormattingInfo) {
+ converter.format(event, buf);
+ } else {
+ formatWithInfo(event, buf);
+ }
+ }
+ private void formatWithInfo(final LogEvent event, final StringBuilder buf) {
final int startField = buf.length();
converter.format(event, buf);
field.format(startField, buf);
[2/2] logging-log4j2 git commit: Merge remote-tracking branch
'origin/master'
Posted by rp...@apache.org.
Merge remote-tracking branch 'origin/master'
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/e07c41fc
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/e07c41fc
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/e07c41fc
Branch: refs/heads/master
Commit: e07c41fc7f3ee774635620312f72293e32a87253
Parents: 9898972 09748f9
Author: rpopma <rp...@apache.org>
Authored: Sun Feb 14 19:57:54 2016 +0900
Committer: rpopma <rp...@apache.org>
Committed: Sun Feb 14 19:57:54 2016 +0900
----------------------------------------------------------------------
.../log4j/message/AbstractMessageFactory.java | 73 +++++++++----
.../log4j/message/FormattedMessageFactory.java | 17 +++
.../log4j/message/LocalizedMessageFactory.java | 24 ++++-
.../message/MessageFormatMessageFactory.java | 17 +++
.../message/ParameterizedMessageFactory.java | 17 +++
.../ParameterizedNoReferenceMessageFactory.java | 17 +++
.../message/StringFormatterMessageFactory.java | 17 +++
.../log4j/message/ThreadDumpMessage.java | 1 -
.../org/apache/logging/log4j/LoggerTest.java | 18 +++-
.../log4j/core/layout/PatternLayoutTest.java | 106 +++++++++----------
10 files changed, 229 insertions(+), 78 deletions(-)
----------------------------------------------------------------------