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/04/12 18:33:52 UTC
[12/17] logging-log4j2 git commit: LOG4J2-1343 performance
optimization: if immediateFlush and buffer is empty then write straight to
the file without copying into the buffer
LOG4J2-1343 performance optimization: if immediateFlush and buffer is empty then write straight to the file without copying into the buffer
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/3c6584e4
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/3c6584e4
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/3c6584e4
Branch: refs/heads/master
Commit: 3c6584e47ec0df29586bd577ba3368592159a240
Parents: 141bdd2
Author: rpopma <rp...@apache.org>
Authored: Tue Apr 12 20:17:38 2016 +0900
Committer: rpopma <rp...@apache.org>
Committed: Tue Apr 12 20:17:38 2016 +0900
----------------------------------------------------------------------
.../apache/logging/log4j/core/appender/OutputStreamManager.java | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/3c6584e4/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/OutputStreamManager.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/OutputStreamManager.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/OutputStreamManager.java
index 7379804..c1b4934 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/OutputStreamManager.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/OutputStreamManager.java
@@ -170,7 +170,10 @@ public class OutputStreamManager extends AbstractManager implements ByteBufferDe
* @throws AppenderLoggingException if an error occurs.
*/
protected synchronized void write(final byte[] bytes, final int offset, final int length, boolean immediateFlush) {
- // System.out.println("write " + count);
+ if (immediateFlush && byteBuffer.position() == 0) {
+ writeToDestination(bytes, offset, length);
+ return;
+ }
if (length >= byteBuffer.capacity()) {
// if request length exceeds buffer capacity, flush the buffer and write the data directly
flush();