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 2014/09/03 07:23:53 UTC

[1/6] Rename log4j-streams to log4j-iostreams.

Repository: logging-log4j2
Updated Branches:
  refs/heads/master 49aaf52f7 -> b5bc43857


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ffc1a38a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerInputStreamTest.java
----------------------------------------------------------------------
diff --git a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerInputStreamTest.java b/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerInputStreamTest.java
deleted file mode 100644
index 30ec88a..0000000
--- a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerInputStreamTest.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.logging.log4j.streams;
-
-import static org.junit.Assert.assertEquals;
-
-import java.io.BufferedInputStream;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-
-import org.junit.Before;
-import org.junit.Test;
-
-public class LoggerInputStreamTest extends AbstractStreamTest {
-    protected ByteArrayInputStream wrapped;
-    protected ByteArrayOutputStream read;
-    protected InputStream in;
-
-    protected InputStream createInputStream() {
-        return new LoggerInputStream(this.wrapped, getExtendedLogger(), LEVEL);
-    }
-
-    @Before
-    public void createStream() {
-        this.wrapped = new ByteArrayInputStream((FIRST + "\r\n" + LAST).getBytes());
-        this.read = new ByteArrayOutputStream();
-        this.in = createInputStream();
-    }
-    
-    @Test
-    public void testClose_HasRemainingData() throws IOException {
-        final byte[] bytes = new byte[1024];
-        this.in.read(bytes);
-        assertMessages(FIRST);
-        this.in.close();
-        assertMessages(FIRST, LAST);
-    }
-
-    @Test
-    public void testClose_NoRemainingData() throws IOException {
-        this.wrapped = new ByteArrayInputStream((FIRST + '\n').getBytes());
-        this.in = new LoggerInputStream(this.wrapped, getExtendedLogger(), LEVEL);
-
-        final byte[] bytes = new byte[1024];
-        this.in.read(bytes);
-        assertMessages(FIRST);
-        this.in.close();
-        assertMessages(FIRST);
-    }
-
-    @Test
-    public void testRead_ByteArray() throws Exception {
-        final byte[] bytes = new byte[FIRST.length()];
-        assertEquals("len", bytes.length, this.in.read(bytes));
-        if (!(this.in instanceof BufferedInputStream)) {
-            assertMessages();
-        }
-        this.in.read(bytes);
-        assertMessages(FIRST);
-    }
-
-    @Test
-    public void testRead_ByteArray_Offset_Length() throws Exception {
-        final byte[] bytes = new byte[FIRST.length() * 2];
-        assertEquals("len", FIRST.length(), this.in.read(bytes, 0, FIRST.length()));
-        if (!(this.in instanceof BufferedInputStream)) {
-            assertMessages();
-        }
-        this.in.read(bytes);
-        assertMessages(FIRST);
-    }
-
-    @Test
-    public void testRead_IgnoresWindowsNewline() throws IOException {
-        final byte[] bytes = new byte[1024];
-        final int len = this.in.read(bytes);
-        this.read.write(bytes, 0, len);
-        assertMessages(FIRST);
-        assertEquals(FIRST + "\r\n" + LAST, this.read.toString());
-        this.in.close();
-        assertMessages(FIRST, LAST);
-    }
-
-    @Test
-    public void testRead_int() throws Exception {
-        for (int i = 0; i < FIRST.length(); i++) {
-            this.read.write(this.in.read());
-        }
-        if (!(this.in instanceof BufferedInputStream)) {
-            assertMessages();
-        }
-        assertEquals("carriage return", '\r', this.in.read());
-        if (!(this.in instanceof BufferedInputStream)) {
-            assertMessages();
-        }
-        assertEquals("newline", '\n', this.in.read());
-        assertMessages(FIRST);
-    }
-
-    @Test
-    public void testRead_MultipleLines() throws IOException {
-        this.wrapped = new ByteArrayInputStream((FIRST + "\n" + LAST + '\n').getBytes());
-        this.in = new LoggerInputStream(this.wrapped, getExtendedLogger(), LEVEL);
-
-        final byte[] bytes = new byte[1024];
-        final int len = this.in.read(bytes);
-        this.read.write(bytes, 0, len);
-        assertMessages(FIRST, LAST);
-        assertEquals(FIRST + '\n' + LAST + '\n', this.read.toString());
-    }
-}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ffc1a38a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerOutputStreamCallerInfoTest.java
----------------------------------------------------------------------
diff --git a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerOutputStreamCallerInfoTest.java b/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerOutputStreamCallerInfoTest.java
deleted file mode 100644
index 73fb966..0000000
--- a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerOutputStreamCallerInfoTest.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.logging.log4j.streams;
-
-import org.apache.logging.log4j.Level;
-import org.junit.Before;
-import org.junit.Test;
-
-public class LoggerOutputStreamCallerInfoTest extends LoggerStreamsCallerInfoTesting {
-
-    private LoggerOutputStream logOut;
-    
-    @Before
-    public void setupStreams() {
-        this.logOut = new LoggerOutputStream(getExtendedLogger(), Level.WARN);
-    }
-    
-    @Test
-    public void write() throws Exception {
-        this.logOut.write('a');
-        assertMessages("before write int", 0, "write");
-        this.logOut.write('\n');
-        assertMessages("after write int", 1, "write");
-        
-        this.logOut.write("b\n".getBytes());
-        assertMessages("after write byte array", 2, "write");
-
-        this.logOut.write("c\n".getBytes(), 0, 2);
-        assertMessages("after write byte array offset size", 3, "write");
-
-        this.logOut.write('d');
-        assertMessages("before close size", 3, "write");
-        this.logOut.close();
-        assertMessages("after close size", 4, "write");
-    }
-}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ffc1a38a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerOutputStreamTest.java
----------------------------------------------------------------------
diff --git a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerOutputStreamTest.java b/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerOutputStreamTest.java
deleted file mode 100644
index 2847a94..0000000
--- a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerOutputStreamTest.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.logging.log4j.streams;
-
-import java.io.ByteArrayOutputStream;
-import java.io.OutputStream;
-
-import org.apache.logging.log4j.Level;
-
-public class LoggerOutputStreamTest extends AbstractLoggerOutputStreamTest {
-
-    @Override
-    protected ByteArrayOutputStream createOutputStream() {
-        return null;
-    }
-
-    @Override
-    protected OutputStream createOutputStreamWrapper() {
-        return new LoggerOutputStream(getExtendedLogger(), Level.ERROR);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ffc1a38a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerPrintStreamCallerInfoTest.java
----------------------------------------------------------------------
diff --git a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerPrintStreamCallerInfoTest.java b/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerPrintStreamCallerInfoTest.java
deleted file mode 100644
index ad6aeda..0000000
--- a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerPrintStreamCallerInfoTest.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.logging.log4j.streams;
-
-import java.io.UnsupportedEncodingException;
-import java.util.Locale;
-
-import org.apache.logging.log4j.Level;
-import org.junit.Before;
-import org.junit.Test;
-
-public class LoggerPrintStreamCallerInfoTest extends LoggerStreamsCallerInfoTesting {
-
-    private LoggerPrintStream logOut;
-    
-    @Test
-    public void close() throws Exception {
-        this.logOut.print("a\nb");
-        assertMessages("before close size", 1, "close");
-        this.logOut.close();
-        assertMessages("after close size", 2, "close");
-    }
-    
-    @Test
-    public void print_boolean() throws Exception {
-        this.logOut.print(true);
-        assertMessages("print", 0, "print_boolean");
-        this.logOut.println(true);
-        assertMessages("println", 1, "print_boolean");
-    }
-    
-    @Test
-    public void print_char() throws Exception {
-        this.logOut.print('a');
-        assertMessages("print", 0, "print_char");
-        this.logOut.println('b');
-        assertMessages("println", 1, "print_char");
-    }
-    
-    @Test
-    public void print_chararray() throws Exception {
-        this.logOut.print("a".toCharArray());
-        assertMessages("print", 0, "print_chararray");
-        this.logOut.println("b".toCharArray());
-        assertMessages("println", 1, "print_chararray");
-    }
-    
-    @Test
-    public void print_double() throws Exception {
-        this.logOut.print(1D);
-        assertMessages("print", 0, "print_double");
-        this.logOut.println(2D);
-        assertMessages("println", 1, "print_double");
-    }
-    
-    @Test
-    public void print_float() throws Exception {
-        this.logOut.print(1f);
-        assertMessages("print", 0, "print_float");
-        this.logOut.println(2f);
-        assertMessages("println", 1, "print_float");
-    }
-    
-    @Test
-    public void print_int() throws Exception {
-        this.logOut.print(1);
-        assertMessages("print", 0, "print_int");
-        this.logOut.println(2);
-        assertMessages("println", 1, "print_int");
-    }
-    
-    @Test
-    public void print_long() throws Exception {
-        this.logOut.print(1L);
-        assertMessages("print", 0, "print_long");
-        this.logOut.println(2L);
-        assertMessages("println", 1, "print_long");
-    }
-    
-    @Test
-    public void print_object() throws Exception {
-        this.logOut.print((Object) 'a');
-        assertMessages("print", 0, "print_object");
-        this.logOut.println((Object) 'b');
-        assertMessages("println", 1, "print_object");
-    }
-    
-    @Test
-    public void print_printf() throws Exception {
-        this.logOut.printf("a\n");
-        assertMessages("println", 1, "print_printf");
-    }
-    
-    @Test
-    public void print_printf_locale() throws Exception {
-        this.logOut.printf(Locale.getDefault(), "a\n");
-        assertMessages("println", 1, "print_printf_locale");
-    }
-    
-    @Test
-    public void print_string() throws Exception {
-        this.logOut.print("a");
-        assertMessages("print", 0, "print_string");
-        this.logOut.println("b");
-        assertMessages("println", 1, "print_string");
-    }
-    
-    @Before
-    public void setupStreams() throws UnsupportedEncodingException {
-        this.logOut = new LoggerPrintStream(getLogger(), Level.WARN);
-    }
-    
-    @Test
-    public void write_bytes() throws Exception {
-        this.logOut.write("b\n".getBytes());
-        assertMessages("write", 1, "write_bytes");
-    }
-    
-    @Test
-    public void write_bytes_offset() throws Exception {
-        this.logOut.write("c\n".getBytes(), 0, 2);
-        assertMessages("write", 1, "write_bytes_offset");
-    }
-    
-    @Test
-    public void write_int() throws Exception {
-        this.logOut.write('a');
-        assertMessages("write int", 0, "write_int");
-        this.logOut.write('\n');
-        assertMessages("write newline", 1, "write_int");
-    }
-}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ffc1a38a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerPrintStreamTest.java
----------------------------------------------------------------------
diff --git a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerPrintStreamTest.java b/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerPrintStreamTest.java
deleted file mode 100644
index b1df321..0000000
--- a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerPrintStreamTest.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.logging.log4j.streams;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertSame;
-
-import java.io.ByteArrayOutputStream;
-import java.io.OutputStream;
-
-import org.junit.Test;
-
-public class LoggerPrintStreamTest extends AbstractLoggerOutputStreamTest {
-    private LoggerPrintStream print;
-
-    @Override
-    protected ByteArrayOutputStream createOutputStream() {
-        return new ByteArrayOutputStream();
-    }
-
-    @Override
-    protected OutputStream createOutputStreamWrapper() {
-        return this.print = new LoggerPrintStream(this.wrapped, getExtendedLogger(), LEVEL);
-    }
-
-    @Test
-    public void testFormat() throws Exception {
-        assertSame(this.print, this.print.format("[%s]", FIRST));
-        assertMessages();
-        this.print.println();
-        assertMessages("[" + FIRST + "]");
-        assertEquals("[" + FIRST + "]" + NEWLINE, this.wrapped.toString());
-    }
-
-    @Test
-    public void testPrint_boolean() throws Exception {
-        this.print.print(true);
-        assertMessages();
-        this.print.println();
-        assertMessages("true");
-        assertEquals("true" + NEWLINE, this.wrapped.toString());
-    }
-
-    @Test
-    public void testPrint_char() throws Exception {
-        for (final char c : FIRST.toCharArray()) {
-            this.print.print(c);
-            assertMessages();
-        }
-        this.print.println();
-        assertMessages(FIRST);
-        assertEquals(FIRST + NEWLINE, this.wrapped.toString());
-    }
-
-    @Test
-    public void testPrint_CharacterArray() throws Exception {
-        this.print.print(FIRST.toCharArray());
-        assertMessages();
-        this.print.println();
-        assertMessages(FIRST);
-        assertEquals(FIRST + NEWLINE, this.wrapped.toString());
-    }
-
-    @Test
-    public void testPrint_int() throws Exception {
-        this.print.print(12);
-        assertMessages();
-        this.print.println();
-        assertMessages("12");
-        assertEquals("12" + NEWLINE, this.wrapped.toString());
-    }
-
-    @Test
-    public void testPrint_long() throws Exception {
-        this.print.print(12L);
-        assertMessages();
-        this.print.println();
-        assertMessages("12");
-        assertEquals("12" + NEWLINE, this.wrapped.toString());
-    }
-
-    @Test
-    public void testPrint_Object() throws Exception {
-        this.print.print((Object) FIRST);
-        assertMessages();
-        this.print.println();
-        assertMessages(FIRST);
-        assertEquals(FIRST + NEWLINE, this.wrapped.toString());
-    }
-
-    @Test
-    public void testPrint_String() throws Exception {
-        this.print.print(FIRST);
-        assertMessages();
-        this.print.println();
-        assertMessages(FIRST);
-        assertEquals(FIRST + NEWLINE, this.wrapped.toString());
-    }
-
-    @Test
-    public void testPrintf() throws Exception {
-        assertSame(this.print,  this.print.printf("<<<%s>>>", FIRST));
-        assertMessages();
-        this.print.println();
-        assertMessages("<<<" + FIRST + ">>>");
-        assertEquals("<<<" + FIRST + ">>>" + NEWLINE, this.wrapped.toString());
-    }
-}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ffc1a38a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerPrintWriterCallerInfoTest.java
----------------------------------------------------------------------
diff --git a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerPrintWriterCallerInfoTest.java b/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerPrintWriterCallerInfoTest.java
deleted file mode 100644
index 16e271e..0000000
--- a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerPrintWriterCallerInfoTest.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.logging.log4j.streams;
-
-import java.util.Locale;
-
-import org.apache.logging.log4j.Level;
-import org.junit.Before;
-import org.junit.Test;
-
-public class LoggerPrintWriterCallerInfoTest extends LoggerStreamsCallerInfoTesting {
-
-    private LoggerPrintWriter logOut;
-    
-    @Test
-    public void close() throws Exception {
-        this.logOut.print("a\nb");
-        assertMessages("before close size", 1, "close");
-        this.logOut.close();
-        assertMessages("after close size", 2, "close");
-    }
-    
-    @Test
-    public void print_boolean() throws Exception {
-        this.logOut.print(true);
-        assertMessages("print", 0, "print_boolean");
-        this.logOut.println(true);
-        assertMessages("println", 1, "print_boolean");
-    }
-    
-    @Test
-    public void print_char() throws Exception {
-        this.logOut.print('a');
-        assertMessages("print", 0, "print_char");
-        this.logOut.println('b');
-        assertMessages("println", 1, "print_char");
-    }
-    
-    @Test
-    public void print_chararray() throws Exception {
-        this.logOut.print("a".toCharArray());
-        assertMessages("print", 0, "print_chararray");
-        this.logOut.println("b".toCharArray());
-        assertMessages("println", 1, "print_chararray");
-    }
-    
-    @Test
-    public void print_double() throws Exception {
-        this.logOut.print(1D);
-        assertMessages("print", 0, "print_double");
-        this.logOut.println(2D);
-        assertMessages("println", 1, "print_double");
-    }
-    
-    @Test
-    public void print_float() throws Exception {
-        this.logOut.print(1f);
-        assertMessages("print", 0, "print_float");
-        this.logOut.println(2f);
-        assertMessages("println", 1, "print_float");
-    }
-    
-    @Test
-    public void print_int() throws Exception {
-        this.logOut.print(1);
-        assertMessages("print", 0, "print_int");
-        this.logOut.println(2);
-        assertMessages("println", 1, "print_int");
-    }
-    
-    @Test
-    public void print_long() throws Exception {
-        this.logOut.print(1L);
-        assertMessages("print", 0, "print_long");
-        this.logOut.println(2L);
-        assertMessages("println", 1, "print_long");
-    }
-    
-    @Test
-    public void print_object() throws Exception {
-        this.logOut.print((Object) 'a');
-        assertMessages("print", 0, "print_object");
-        this.logOut.println((Object) 'b');
-        assertMessages("println", 1, "print_object");
-    }
-    
-    @Test
-    public void print_printf() throws Exception {
-        this.logOut.printf("a\n");
-        assertMessages("println", 1, "print_printf");
-    }
-    
-    @Test
-    public void print_printf_locale() throws Exception {
-        this.logOut.printf(Locale.getDefault(), "a\n");
-        assertMessages("println", 1, "print_printf_locale");
-    }
-    
-    @Test
-    public void print_string() throws Exception {
-        this.logOut.print("a");
-        assertMessages("print", 0, "print_string");
-        this.logOut.println("b");
-        assertMessages("println", 1, "print_string");
-    }
-    
-    @Before
-    public void setupStreams() {
-        this.logOut = new LoggerPrintWriter(getLogger(), Level.WARN);
-    }
-    
-    @Test
-    public void write_bytes() throws Exception {
-        this.logOut.write("b\n".toCharArray());
-        assertMessages("write", 1, "write_bytes");
-    }
-    
-    @Test
-    public void write_bytes_offset() throws Exception {
-        this.logOut.write("c\n".toCharArray(), 0, 2);
-        assertMessages("write", 1, "write_bytes_offset");
-    }
-    
-    @Test
-    public void write_int() throws Exception {
-        this.logOut.write('a');
-        assertMessages("write int", 0, "write_int");
-        this.logOut.write('\n');
-        assertMessages("write newline", 1, "write_int");
-    }
-}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ffc1a38a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerPrintWriterTest.java
----------------------------------------------------------------------
diff --git a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerPrintWriterTest.java b/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerPrintWriterTest.java
deleted file mode 100644
index d10b962..0000000
--- a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerPrintWriterTest.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.logging.log4j.streams;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertSame;
-
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.io.Writer;
-
-import org.junit.Test;
-
-public class LoggerPrintWriterTest extends AbstractLoggerWriterTest {
-    private PrintWriter print; 
-
-    @Override
-    protected StringWriter createWriter() {
-        return new StringWriter();
-    }
-
-    @Override
-    protected Writer createWriterWrapper() {
-        this.print = new LoggerPrintWriter(this.wrapped, getExtendedLogger(), LEVEL);
-        return this.print;
-    }
-
-    @Test
-    public void testFormat() throws Exception {
-        assertSame(this.print, this.print.format("[%s]", FIRST));
-        assertMessages();
-        this.print.println();
-        assertMessages("[" + FIRST + "]");
-        assertEquals("[" + FIRST + "]" + NEWLINE, this.wrapped.toString());
-    }
-
-    @Test
-    public void testPrint_boolean() throws Exception {
-        this.print.print(true);
-        assertMessages();
-        this.print.println();
-        assertMessages("true");
-        assertEquals("true" + NEWLINE, this.wrapped.toString());
-    }
-
-    @Test
-    public void testPrint_char() throws Exception {
-        for (final char c : FIRST.toCharArray()) {
-            this.print.print(c);
-            assertMessages();
-        }
-        this.print.println();
-        assertMessages(FIRST);
-        assertEquals(FIRST + NEWLINE, this.wrapped.toString());
-    }
-
-    @Test
-    public void testPrint_CharacterArray() throws Exception {
-        this.print.print(FIRST.toCharArray());
-        assertMessages();
-        this.print.println();
-        assertMessages(FIRST);
-        assertEquals(FIRST + NEWLINE, this.wrapped.toString());
-    }
-
-    @Test
-    public void testPrint_int() throws Exception {
-        this.print.print(12);
-        assertMessages();
-        this.print.println();
-        assertMessages("12");
-        assertEquals("12" + NEWLINE, this.wrapped.toString());
-    }
-
-    @Test
-    public void testPrint_long() throws Exception {
-        this.print.print(12L);
-        assertMessages();
-        this.print.println();
-        assertMessages("12");
-        assertEquals("12" + NEWLINE, this.wrapped.toString());
-    }
-
-    @Test
-    public void testPrint_Object() throws Exception {
-        this.print.print((Object) FIRST);
-        assertMessages();
-        this.print.println();
-        assertMessages(FIRST);
-        assertEquals(FIRST + NEWLINE, this.wrapped.toString());
-    }
-
-    @Test
-    public void testPrint_String() throws Exception {
-        this.print.print(FIRST);
-        assertMessages();
-        this.print.println();
-        assertMessages(FIRST);
-        assertEquals(FIRST + NEWLINE, this.wrapped.toString());
-    }
-
-    @Test
-    public void testPrintf() throws Exception {
-        assertSame(this.print,  this.print.printf("<<<%s>>>", FIRST));
-        assertMessages();
-        this.print.println();
-        assertMessages("<<<" + FIRST + ">>>");
-        assertEquals("<<<" + FIRST + ">>>" + NEWLINE, this.wrapped.toString());
-    }
-}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ffc1a38a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerReaderCallerInfoTest.java
----------------------------------------------------------------------
diff --git a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerReaderCallerInfoTest.java b/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerReaderCallerInfoTest.java
deleted file mode 100644
index 88c2311..0000000
--- a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerReaderCallerInfoTest.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.logging.log4j.streams;
-
-import java.io.Reader;
-import java.io.StringReader;
-import java.nio.CharBuffer;
-
-import org.junit.Before;
-import org.junit.Test;
-
-public class LoggerReaderCallerInfoTest extends LoggerStreamsCallerInfoTesting {
-
-    LoggerReader logReader;
-    
-    @Test
-    public void read() throws Exception {
-        this.logReader.read();
-        assertMessages("before read int size", 0, "read");
-        this.logReader.read();
-        assertMessages("after read int size", 1, "read");
-
-        this.logReader.read(new char[2]);
-        assertMessages("after read bytes size", 2, "read");
-
-        this.logReader.read(new char[2], 0, 2);
-        assertMessages("after read bytes offset size", 3, "read");
-
-        this.logReader.read(CharBuffer.allocate(2));
-        assertMessages("after read charBuffer size", 4, "read");
-
-        this.logReader.read();
-        assertMessages("before close size", 4, "read");
-        this.logReader.close();
-        assertMessages("after close size", 5, "read");
-    }
-
-    @Before
-    public void setupReader() {
-        final Reader srcReader = new StringReader("a\nb\nc\nd\ne");
-        this.logReader = new LoggerReader(srcReader, getLogger(), LEVEL);
-    }
-}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ffc1a38a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerReaderTest.java
----------------------------------------------------------------------
diff --git a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerReaderTest.java b/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerReaderTest.java
deleted file mode 100644
index 662c8be..0000000
--- a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerReaderTest.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.logging.log4j.streams;
-
-import static org.junit.Assert.assertEquals;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.Reader;
-import java.io.StringReader;
-import java.io.StringWriter;
-import java.nio.CharBuffer;
-
-import org.junit.Before;
-import org.junit.Test;
-
-public class LoggerReaderTest extends AbstractStreamTest {
-    protected StringReader wrapped;
-    protected StringWriter read;
-    protected Reader reader;
-
-    protected Reader createReader() {
-        return new LoggerReader(this.wrapped, getExtendedLogger(), LEVEL);
-    }
-    
-    @Before
-    public void createStream() {
-        this.wrapped = new StringReader(FIRST + "\r\n" + LAST);
-        this.read = new StringWriter();
-        this.reader = createReader();
-    }
-
-    @Test
-    public void testClose_HasRemainingData() throws IOException {
-        final char[] chars = new char[1024];
-        this.reader.read(chars);
-        if (!(this.reader instanceof BufferedReader)) {
-            assertMessages(FIRST);
-        }
-        this.reader.close();
-        assertMessages(FIRST, LAST);
-    }
-
-    @Test
-    public void testClose_NoRemainingData() throws IOException {
-        this.wrapped = new StringReader(FIRST + '\n');
-        this.reader = createReader();
-
-        final char[] chars = new char[1024];
-        this.reader.read(chars);
-        assertMessages(FIRST);
-        this.reader.close();
-        assertMessages(FIRST);
-    }
-
-    @Test
-    public void testRead_CharArray() throws Exception {
-        final char[] chars = new char[FIRST.length()];
-        assertEquals("len", FIRST.length(), this.reader.read(chars));
-        if (!(this.reader instanceof BufferedReader)) {
-            assertMessages();
-        }
-        this.reader.read(chars);
-        assertMessages(FIRST);
-    }
-
-    @Test
-    public void testRead_CharArray_Offset_Length() throws Exception {
-        final char[] chars = new char[1024];
-        assertEquals("len", FIRST.length(), this.reader.read(chars, 0, FIRST.length()));
-        if (!(this.reader instanceof BufferedReader)) {
-            assertMessages();
-        }
-        this.reader.read(chars);
-        this.reader.close();
-        assertMessages(FIRST, LAST);
-    }
-
-    @Test
-    public void testRead_CharBuffer() throws Exception {
-        final CharBuffer chars = CharBuffer.allocate(1024);
-        assertEquals("len", FIRST.length() + LAST.length() + 2, this.reader.read(chars));
-        this.reader.close();
-        assertMessages(FIRST, LAST);
-    }
-
-    @Test
-    public void testRead_IgnoresWindowsNewline() throws IOException {
-        final char[] chars = new char[1024];
-        final int len = this.reader.read(chars);
-        this.read.write(chars, 0, len);
-        if (!(this.reader instanceof BufferedReader)) {
-            assertMessages(FIRST);
-        }
-        assertEquals(FIRST + "\r\n" + LAST, this.read.toString());
-        this.reader.close();
-        assertMessages(FIRST, LAST);
-    }
-
-    @Test
-    public void testRead_int() throws Exception {
-        for (int i = 0; i < FIRST.length(); i++) {
-            this.read.write(this.reader.read());
-        }
-        if (!(this.reader instanceof BufferedReader)) {
-            assertMessages();
-        }
-        assertEquals("carriage return", '\r', this.reader.read());
-        if (!(this.reader instanceof BufferedReader)) {
-            assertMessages();
-        }
-        assertEquals("newline", '\n', this.reader.read());
-        assertMessages(FIRST);
-    }
-
-    @Test
-    public void testRead_MultipleLines() throws IOException {
-        this.wrapped = new StringReader(FIRST + "\n" + LAST + '\n');
-        this.reader = createReader();
-
-        final char[] chars = new char[1024];
-        final int len = this.reader.read(chars);
-        this.read.write(chars, 0, len);
-        assertMessages(FIRST, LAST);
-        assertEquals(FIRST + '\n' + LAST + '\n', this.read.toString());
-    }
-}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ffc1a38a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerStreamsCallerInfoTesting.java
----------------------------------------------------------------------
diff --git a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerStreamsCallerInfoTesting.java b/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerStreamsCallerInfoTesting.java
deleted file mode 100644
index 0af5a30..0000000
--- a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerStreamsCallerInfoTesting.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.logging.log4j.streams;
-
-import static org.junit.Assert.assertEquals;
-
-import org.apache.logging.log4j.Level;
-import org.apache.logging.log4j.core.Logger;
-import org.apache.logging.log4j.junit.InitialLoggerContext;
-import org.apache.logging.log4j.test.appender.ListAppender;
-import org.junit.Before;
-import org.junit.ClassRule;
-
-public class LoggerStreamsCallerInfoTesting {
-
-    protected static Logger getExtendedLogger() {
-        return ctx.getLogger("ClassAndMethodLogger");
-    }
-    
-    protected static Logger getLogger() {
-        return getExtendedLogger();
-    }
-    
-    protected final static Level LEVEL = Level.WARN;
-
-    @ClassRule
-    public static InitialLoggerContext ctx = new InitialLoggerContext("log4j2-streams-calling-info.xml");
-
-    public void assertMessages(final String msg, final int size, final String methodName) {
-        final ListAppender appender = (ListAppender) ctx.getAppender("ClassAndMethod");
-        assertEquals(msg + ".size", size, appender.getMessages().size());
-        for (final String message : appender.getMessages()) {
-            assertEquals(msg + " has incorrect caller info", this.getClass().getName() + '.' + methodName, message);
-        }
-    }
-
-    @Before
-    public void clearAppender() {
-        ((ListAppender) ctx.getAppender("ClassAndMethod")).clear();
-    }
-}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ffc1a38a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerWriterTest.java
----------------------------------------------------------------------
diff --git a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerWriterTest.java b/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerWriterTest.java
deleted file mode 100644
index 8378348..0000000
--- a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerWriterTest.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.logging.log4j.streams;
-
-import java.io.StringWriter;
-import java.io.Writer;
-
-public class LoggerWriterTest extends AbstractLoggerWriterTest {
-
-    @Override
-    protected StringWriter createWriter() {
-        return null;
-    }
-
-    @Override
-    protected Writer createWriterWrapper() {
-        return new LoggerWriter(getExtendedLogger(), LEVEL);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ffc1a38a/log4j-streams/src/test/resources/log4j2-streams-calling-info.xml
----------------------------------------------------------------------
diff --git a/log4j-streams/src/test/resources/log4j2-streams-calling-info.xml b/log4j-streams/src/test/resources/log4j2-streams-calling-info.xml
deleted file mode 100644
index 5f8dfd9..0000000
--- a/log4j-streams/src/test/resources/log4j2-streams-calling-info.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  ~ Licensed to the Apache Software Foundation (ASF) under one or more
-  ~ contributor license agreements.  See the NOTICE file distributed with
-  ~ this work for additional information regarding copyright ownership.
-  ~ The ASF licenses this file to You under the Apache License, Version 2.0
-  ~ (the "License"); you may not use this file except in compliance with
-  ~ the License.  You may obtain a copy of the License at
-  ~
-  ~     http://www.apache.org/licenses/LICENSE-2.0
-  ~
-  ~ Unless required by applicable law or agreed to in writing, software
-  ~ distributed under the License is distributed on an "AS IS" BASIS,
-  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  ~ See the License for the specific language governing permissions and
-  ~ limitations under the License.
-  -->
-<Configuration name="CallerInformationTest" status="error" packages="org.apache.logging.log4j.test">
-  <Appenders>
-    <List name="ClassAndMethod">
-      <PatternLayout pattern="%class.%method"/>
-    </List>
-  </Appenders>
-  <Loggers>
-    <Logger name="ClassAndMethodLogger" level="info">
-      <AppenderRef ref="ClassAndMethod"/>
-    </Logger>
-    <Root level="off"/>
-  </Loggers>
-</Configuration>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ffc1a38a/log4j-streams/src/test/resources/log4j2-streams-unit-test.xml
----------------------------------------------------------------------
diff --git a/log4j-streams/src/test/resources/log4j2-streams-unit-test.xml b/log4j-streams/src/test/resources/log4j2-streams-unit-test.xml
deleted file mode 100644
index d6f0211..0000000
--- a/log4j-streams/src/test/resources/log4j2-streams-unit-test.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  ~ Licensed to the Apache Software Foundation (ASF) under one or more
-  ~ contributor license agreements.  See the NOTICE file distributed with
-  ~ this work for additional information regarding copyright ownership.
-  ~ The ASF licenses this file to You under the Apache License, Version 2.0
-  ~ (the "License"); you may not use this file except in compliance with
-  ~ the License.  You may obtain a copy of the License at
-  ~
-  ~     http://www.apache.org/licenses/LICENSE-2.0
-  ~
-  ~ Unless required by applicable law or agreed to in writing, software
-  ~ distributed under the License is distributed on an "AS IS" BASIS,
-  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  ~ See the License for the specific language governing permissions and
-  ~ limitations under the License.
-  -->
-<Configuration name="UnitTest" status="error" packages="org.apache.logging.log4j.test">
-  <Appenders>
-    <List name="UnitTest">
-      <PatternLayout pattern="%level %m%n"/>
-    </List>
-  </Appenders>
-  <Loggers>
-    <Logger name="UnitTestLogger" level="info">
-      <AppenderRef ref="UnitTest"/>
-    </Logger>
-    <Root level="off"/>
-  </Loggers>
-</Configuration>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ffc1a38a/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index d10f730..2abd5b4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1003,7 +1003,7 @@
     <module>log4j-nosql</module>
     <module>log4j-web</module>
     <module>log4j-perf</module>
-    <module>log4j-streams</module>
+    <module>log4j-iostreams</module>
   </modules>
   <profiles>
     <profile>


[4/6] git commit: Rename log4j-streams to log4j-iostreams.

Posted by ma...@apache.org.
Rename log4j-streams to log4j-iostreams.


Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/ffc1a38a
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/ffc1a38a
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/ffc1a38a

Branch: refs/heads/master
Commit: ffc1a38a695edf08812e37d26dee78ee8a7dbf29
Parents: bb5d55b
Author: Matt Sicker <ma...@apache.org>
Authored: Wed Sep 3 00:19:19 2014 -0500
Committer: Matt Sicker <ma...@apache.org>
Committed: Wed Sep 3 00:19:19 2014 -0500

----------------------------------------------------------------------
 log4j-iostreams/.gitignore                      | Bin 0 -> 69 bytes
 log4j-iostreams/pom.xml                         | 217 ++++++++++++++
 .../log4j/io/LoggerBufferedInputStream.java     | 104 +++++++
 .../logging/log4j/io/LoggerBufferedReader.java  |  91 ++++++
 .../log4j/io/LoggerFilterOutputStream.java      | 101 +++++++
 .../logging/log4j/io/LoggerFilterWriter.java    |  99 +++++++
 .../logging/log4j/io/LoggerInputStream.java     |  92 ++++++
 .../logging/log4j/io/LoggerOutputStream.java    |  87 ++++++
 .../logging/log4j/io/LoggerPrintStream.java     | 284 +++++++++++++++++++
 .../logging/log4j/io/LoggerPrintWriter.java     | 258 +++++++++++++++++
 .../apache/logging/log4j/io/LoggerReader.java   |  95 +++++++
 .../apache/logging/log4j/io/LoggerStreams.java  | 170 +++++++++++
 .../apache/logging/log4j/io/LoggerWriter.java   |  90 ++++++
 .../logging/log4j/io/util/ByteStreamLogger.java | 152 ++++++++++
 .../logging/log4j/io/util/CharStreamLogger.java | 110 +++++++
 .../io/AbstractLoggerOutputStreamTest.java      | 138 +++++++++
 .../log4j/io/AbstractLoggerWriterTest.java      | 138 +++++++++
 .../logging/log4j/io/AbstractStreamTest.java    |  66 +++++
 ...LoggerBufferedInputStreamCallerInfoTest.java |  66 +++++
 .../log4j/io/LoggerBufferedInputStreamTest.java |  29 ++
 .../io/LoggerBufferedReaderCallerInfoTest.java  |  84 ++++++
 .../log4j/io/LoggerBufferedReaderTest.java      |  41 +++
 .../log4j/io/LoggerFilterOutputStreamTest.java  |  36 +++
 .../log4j/io/LoggerFilterWriterTest.java        |  18 ++
 .../io/LoggerInputStreamCallerInfoTest.java     |  54 ++++
 .../logging/log4j/io/LoggerInputStreamTest.java | 127 +++++++++
 .../io/LoggerOutputStreamCallerInfoTest.java    |  50 ++++
 .../log4j/io/LoggerOutputStreamTest.java        |  36 +++
 .../io/LoggerPrintStreamCallerInfoTest.java     | 146 ++++++++++
 .../logging/log4j/io/LoggerPrintStreamTest.java | 122 ++++++++
 .../io/LoggerPrintWriterCallerInfoTest.java     | 145 ++++++++++
 .../logging/log4j/io/LoggerPrintWriterTest.java | 124 ++++++++
 .../log4j/io/LoggerReaderCallerInfoTest.java    |  57 ++++
 .../logging/log4j/io/LoggerReaderTest.java      | 141 +++++++++
 .../io/LoggerStreamsCallerInfoTesting.java      |  55 ++++
 .../logging/log4j/io/LoggerWriterTest.java      |  34 +++
 .../resources/log4j2-streams-calling-info.xml   |  30 ++
 .../test/resources/log4j2-streams-unit-test.xml |  30 ++
 log4j-streams/.gitignore                        | Bin 69 -> 0 bytes
 log4j-streams/pom.xml                           | 212 --------------
 .../streams/LoggerBufferedInputStream.java      | 104 -------
 .../log4j/streams/LoggerBufferedReader.java     |  91 ------
 .../log4j/streams/LoggerFilterOutputStream.java | 101 -------
 .../log4j/streams/LoggerFilterWriter.java       |  99 -------
 .../log4j/streams/LoggerInputStream.java        |  92 ------
 .../log4j/streams/LoggerOutputStream.java       |  87 ------
 .../log4j/streams/LoggerPrintStream.java        | 284 -------------------
 .../log4j/streams/LoggerPrintWriter.java        | 258 -----------------
 .../logging/log4j/streams/LoggerReader.java     |  95 -------
 .../logging/log4j/streams/LoggerStreams.java    | 170 -----------
 .../logging/log4j/streams/LoggerWriter.java     |  90 ------
 .../log4j/streams/util/ByteStreamLogger.java    | 152 ----------
 .../log4j/streams/util/CharStreamLogger.java    | 110 -------
 .../streams/AbstractLoggerOutputStreamTest.java | 138 ---------
 .../log4j/streams/AbstractLoggerWriterTest.java | 138 ---------
 .../log4j/streams/AbstractStreamTest.java       |  66 -----
 ...LoggerBufferedInputStreamCallerInfoTest.java |  66 -----
 .../streams/LoggerBufferedInputStreamTest.java  |  29 --
 .../LoggerBufferedReaderCallerInfoTest.java     |  84 ------
 .../log4j/streams/LoggerBufferedReaderTest.java |  41 ---
 .../streams/LoggerFilterOutputStreamTest.java   |  36 ---
 .../log4j/streams/LoggerFilterWriterTest.java   |  18 --
 .../LoggerInputStreamCallerInfoTest.java        |  54 ----
 .../log4j/streams/LoggerInputStreamTest.java    | 127 ---------
 .../LoggerOutputStreamCallerInfoTest.java       |  50 ----
 .../log4j/streams/LoggerOutputStreamTest.java   |  36 ---
 .../LoggerPrintStreamCallerInfoTest.java        | 146 ----------
 .../log4j/streams/LoggerPrintStreamTest.java    | 122 --------
 .../LoggerPrintWriterCallerInfoTest.java        | 145 ----------
 .../log4j/streams/LoggerPrintWriterTest.java    | 124 --------
 .../streams/LoggerReaderCallerInfoTest.java     |  57 ----
 .../logging/log4j/streams/LoggerReaderTest.java | 141 ---------
 .../streams/LoggerStreamsCallerInfoTesting.java |  55 ----
 .../logging/log4j/streams/LoggerWriterTest.java |  34 ---
 .../resources/log4j2-streams-calling-info.xml   |  30 --
 .../test/resources/log4j2-streams-unit-test.xml |  30 --
 pom.xml                                         |   2 +-
 77 files changed, 3718 insertions(+), 3713 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ffc1a38a/log4j-iostreams/.gitignore
----------------------------------------------------------------------
diff --git a/log4j-iostreams/.gitignore b/log4j-iostreams/.gitignore
new file mode 100644
index 0000000..b79adc7
Binary files /dev/null and b/log4j-iostreams/.gitignore differ

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ffc1a38a/log4j-iostreams/pom.xml
----------------------------------------------------------------------
diff --git a/log4j-iostreams/pom.xml b/log4j-iostreams/pom.xml
new file mode 100644
index 0000000..979494d
--- /dev/null
+++ b/log4j-iostreams/pom.xml
@@ -0,0 +1,217 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.apache.logging.log4j</groupId>
+    <artifactId>log4j</artifactId>
+    <version>2.1-SNAPSHOT</version>
+    <relativePath>../</relativePath>
+  </parent>
+  <artifactId>log4j-iostreams</artifactId>
+  <version>2.1-SNAPSHOT</version>
+  <packaging>jar</packaging>
+  <name>Apache Log4j Streaming Interface</name>
+  <description>Provides the ability to convert streams into log statements</description>
+  <properties>
+    <log4jParentDir>${basedir}/..</log4jParentDir>
+    <docLabel>Streaming Documentation</docLabel>
+    <projectDir>/slf4j-streams</projectDir>
+  </properties>
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-core</artifactId>
+      <scope>test</scope>
+    </dependency>
+
+    <!-- TEST DEPENDENCIES -->
+
+    <!-- Pull in useful test classes from API -->
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-core</artifactId>
+      <type>test-jar</type>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.easymock</groupId>
+      <artifactId>easymock</artifactId>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+  <build>
+    <plugins>
+      <!-- Include the standard NOTICE and LICENSE -->
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-remote-resources-plugin</artifactId>
+        <executions>
+          <execution>
+            <goals>
+              <goal>process</goal>
+            </goals>
+            <configuration>
+              <skip>false</skip>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
+        <configuration>
+          <instructions>
+            <Export-Package>org.apache.logging.log4j.io.*</Export-Package>
+          </instructions>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+  <reporting>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-changes-plugin</artifactId>
+        <version>${changes.plugin.version}</version>
+        <reportSets>
+          <reportSet>
+            <reports>
+              <report>changes-report</report>
+            </reports>
+          </reportSet>
+        </reportSets>
+        <configuration>
+          <issueLinkTemplate>%URL%/show_bug.cgi?id=%ISSUE%</issueLinkTemplate>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-checkstyle-plugin</artifactId>
+        <version>2.7</version>
+        <configuration>
+          <!--<propertiesLocation>${vfs.parent.dir}/checkstyle.properties</propertiesLocation> -->
+          <configLocation>${log4jParentDir}/checkstyle.xml</configLocation>
+          <suppressionsLocation>${log4jParentDir}/checkstyle-suppressions.xml</suppressionsLocation>
+          <enableRulesSummary>false</enableRulesSummary>
+          <propertyExpansion>basedir=${basedir}</propertyExpansion>
+          <propertyExpansion>licensedir=${log4jParentDir}/checkstyle-header.txt</propertyExpansion>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-javadoc-plugin</artifactId>
+        <version>${javadoc.plugin.version}</version>
+        <configuration>
+          <bottom> <![CDATA[<p align="center">Copyright &#169; {inceptionYear}-{currentYear} {organizationName}. All Rights Reserved.<br />
+            Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo,
+            and the Apache Log4j logo are trademarks of The Apache Software Foundation.</p>]]></bottom>
+          <!-- module link generation is completely broken in the javadoc plugin for a multi-module non-aggregating
+               project -->
+          <detectOfflineLinks>false</detectOfflineLinks>
+          <linksource>true</linksource>
+          <tags>
+            <tag>
+              <name>issue</name>
+              <placement>a</placement>
+              <head>JIRA issue:</head>
+            </tag>
+            <tag>
+              <name>doubt</name>
+              <placement>a</placement>
+              <head>Troublesome:</head>
+            </tag>
+            <tag>
+              <name>compare</name>
+              <placement>a</placement>
+              <head>Compare with:</head>
+            </tag>
+          </tags>
+        </configuration>
+        <reportSets>
+          <reportSet>
+            <id>non-aggregate</id>
+            <reports>
+              <report>javadoc</report>
+            </reports>
+          </reportSet>
+        </reportSets>
+      </plugin>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>findbugs-maven-plugin</artifactId>
+        <version>2.5.2</version>
+        <configuration>
+          <fork>true</fork>
+          <jvmArgs>-Duser.language=en</jvmArgs>
+          <threshold>Normal</threshold>
+          <effort>Default</effort>
+          <excludeFilterFile>${log4jParentDir}/findbugs-exclude-filter.xml</excludeFilterFile>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-jxr-plugin</artifactId>
+        <version>2.3</version>
+        <reportSets>
+          <reportSet>
+            <id>non-aggregate</id>
+            <reports>
+              <report>jxr</report>
+            </reports>
+          </reportSet>
+          <reportSet>
+            <id>aggregate</id>
+            <reports>
+              <report>aggregate</report>
+            </reports>
+          </reportSet>
+        </reportSets>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-pmd-plugin</artifactId>
+        <version>${pmd.plugin.version}</version>
+        <configuration>
+          <targetJdk>${maven.compile.target}</targetJdk>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>cobertura-maven-plugin</artifactId>
+        <version>${cobertura.plugin.version}</version>
+        <reportSets>
+          <reportSet>
+            <!-- Disabled as it makes the site build very slow and causes the performance unit test to fail -->
+            <reports />
+          </reportSet>
+        </reportSets>
+      </plugin>
+    </plugins>
+  </reporting>
+</project>
+

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ffc1a38a/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/LoggerBufferedInputStream.java
----------------------------------------------------------------------
diff --git a/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/LoggerBufferedInputStream.java b/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/LoggerBufferedInputStream.java
new file mode 100644
index 0000000..75dbb2f
--- /dev/null
+++ b/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/LoggerBufferedInputStream.java
@@ -0,0 +1,104 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.logging.log4j.io;
+
+import java.io.BufferedInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.charset.Charset;
+
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.Marker;
+import org.apache.logging.log4j.spi.ExtendedLogger;
+
+public class LoggerBufferedInputStream extends BufferedInputStream {
+    private static final String FQCN = LoggerBufferedInputStream.class.getName();
+
+    public LoggerBufferedInputStream(final InputStream in, final Charset charset, final ExtendedLogger logger, final Level level) {
+        this(in, charset, logger, FQCN, level, null);
+    }
+
+    public LoggerBufferedInputStream(final InputStream in, final Charset charset, final ExtendedLogger logger, final Level level, final Marker marker) {
+        this(in, charset, logger, FQCN, level, marker);
+    }
+
+    public LoggerBufferedInputStream(final InputStream in, final Charset charset, final ExtendedLogger logger, final String fqcn, final Level level, final Marker marker) {
+        super(new LoggerInputStream(in, charset, logger, fqcn, level, marker));
+    }
+
+    public LoggerBufferedInputStream(final InputStream in, final Charset charset, final int size, final ExtendedLogger logger, final Level level) {
+        this(in, charset, size, logger, FQCN, level, null);
+    }
+
+    public LoggerBufferedInputStream(final InputStream in, final Charset charset, final int size, final ExtendedLogger logger, final Level level, final Marker marker) {
+        this(in, charset, size, logger, FQCN, level, marker);
+    }
+
+    public LoggerBufferedInputStream(final InputStream in, final Charset charset, final int size, final ExtendedLogger logger, final String fqcn, final Level level, final Marker marker) {
+        super(new LoggerInputStream(in, charset, logger, fqcn, level, marker), size);
+    }
+
+    public LoggerBufferedInputStream(final InputStream in, final ExtendedLogger logger, final Level level) {
+        this(in, logger, FQCN, level, null);
+    }
+
+    public LoggerBufferedInputStream(final InputStream in, final ExtendedLogger logger, final Level level, final Marker marker) {
+        this(in, logger, FQCN, level, marker);
+    }
+
+    public LoggerBufferedInputStream(final InputStream in, final ExtendedLogger logger, final String fqcn, final Level level, final Marker marker) {
+        this(in, Charset.defaultCharset(), logger, fqcn, level, marker);
+    }
+
+    public LoggerBufferedInputStream(final InputStream in, final int size, final ExtendedLogger logger, final Level level) {
+        this(in, size, logger, FQCN, level, null);
+    }
+
+    public LoggerBufferedInputStream(final InputStream in, final int size, final ExtendedLogger logger, final Level level, final Marker marker) {
+        this(in, size, logger, FQCN, level, marker);
+    }
+    
+    public LoggerBufferedInputStream(final InputStream in, final int size, final ExtendedLogger logger, final String fqcn, final Level level, final Marker marker) {
+        this(in, Charset.defaultCharset(), size, logger, fqcn, level, marker);
+    }
+    
+    @Override
+    public void close() throws IOException {
+        super.close();
+    }
+    
+    @Override
+    public synchronized int read() throws IOException {
+        return super.read();
+    }
+    
+    @Override
+    public int read(final byte[] b) throws IOException {
+        return super.read(b, 0, b.length);
+    }
+    
+    @Override
+    public synchronized int read(final byte[] b, final int off, final int len) throws IOException {
+        return super.read(b, off, len);
+    }
+
+    @Override
+    public String toString() {
+        return LoggerBufferedInputStream.class.getSimpleName() + "{stream=" + this.in + '}';
+    }
+}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ffc1a38a/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/LoggerBufferedReader.java
----------------------------------------------------------------------
diff --git a/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/LoggerBufferedReader.java b/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/LoggerBufferedReader.java
new file mode 100644
index 0000000..756f41a
--- /dev/null
+++ b/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/LoggerBufferedReader.java
@@ -0,0 +1,91 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.logging.log4j.io;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.Reader;
+import java.nio.CharBuffer;
+
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.Marker;
+import org.apache.logging.log4j.spi.ExtendedLogger;
+
+public class LoggerBufferedReader extends BufferedReader {
+    private static final String FQCN = LoggerBufferedReader.class.getName();
+
+    public LoggerBufferedReader(final Reader reader, final ExtendedLogger logger, final Level level) {
+        this(reader, logger, FQCN, level, null);
+    }
+
+    public LoggerBufferedReader(final Reader reader, final ExtendedLogger logger, final Level level, final Marker marker) {
+        this(reader, logger, FQCN, level, marker);
+    }
+
+    public LoggerBufferedReader(final Reader reader, final ExtendedLogger logger, final String fqcn, final Level level, final Marker marker) {
+        super(new LoggerReader(reader, logger, FQCN, level, marker));
+    }
+
+    public LoggerBufferedReader(final Reader reader, final int size, final ExtendedLogger logger, final Level level) {
+        this(reader, size, logger, FQCN, level, null);
+    }
+
+    public LoggerBufferedReader(final Reader reader, final int size, final ExtendedLogger logger, final Level level, final Marker marker) {
+        this(reader, size, logger, FQCN, level, marker);
+    }
+
+    public LoggerBufferedReader(final Reader reader, final int size, final ExtendedLogger logger, final String fqcn, final Level level, final Marker marker) {
+        super(new LoggerReader(reader, logger, FQCN, level, marker), size);
+    }
+    
+    @Override
+    public void close() throws IOException {
+        super.close();
+    }
+    
+    @Override
+    public int read() throws IOException {
+        return super.read();
+    }
+    
+    @Override
+    public int read(final char[] cbuf) throws IOException {
+        return super.read(cbuf, 0, cbuf.length);
+    }
+    
+    @Override
+    public int read(final char[] cbuf, final int off, final int len) throws IOException {
+        return super.read(cbuf, off, len);
+    }
+    
+    @Override
+    public int read(final CharBuffer target) throws IOException {
+        final int len = target.remaining();
+        final char[] cbuf = new char[len];
+        final int charsRead = read(cbuf, 0, len);
+        if (charsRead > 0) {
+            target.put(cbuf, 0, charsRead);
+        }
+        return charsRead;
+    }
+    
+    @Override
+    public String readLine() throws IOException {
+        return super.readLine();
+    }
+}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ffc1a38a/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/LoggerFilterOutputStream.java
----------------------------------------------------------------------
diff --git a/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/LoggerFilterOutputStream.java b/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/LoggerFilterOutputStream.java
new file mode 100644
index 0000000..b9e6d78
--- /dev/null
+++ b/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/LoggerFilterOutputStream.java
@@ -0,0 +1,101 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.logging.log4j.io;
+
+import java.io.FilterOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.nio.charset.Charset;
+
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.Marker;
+import org.apache.logging.log4j.spi.ExtendedLogger;
+import org.apache.logging.log4j.io.util.ByteStreamLogger;
+
+/**
+ * Logs each line written to a pre-defined level. Can also be configured with a Marker. This class provides an interface
+ * that follows the {@link java.io.OutputStream} methods in spirit, but doesn't require output to any external stream.
+ * This class should <em>not</em> be used as a stream for an underlying logger unless it's being used as a bridge.
+ * Otherwise, infinite loops may occur!
+ */
+public class LoggerFilterOutputStream extends FilterOutputStream {
+    private static final String FQCN = LoggerFilterOutputStream.class.getName();
+
+    private final ByteStreamLogger logger;
+    private final String fqcn;
+
+    public LoggerFilterOutputStream(final OutputStream out, final Charset charset, final ExtendedLogger logger,
+            final Level level) {
+        this(out, charset, logger, FQCN, level, null);
+    }
+
+    public LoggerFilterOutputStream(final OutputStream out, final Charset charset, final ExtendedLogger logger,
+            final Level level, final Marker marker) {
+        this(out, charset, logger, FQCN, level, marker);
+    }
+
+    public LoggerFilterOutputStream(final OutputStream out, final Charset charset, final ExtendedLogger logger,
+            final String fqcn, final Level level, final Marker marker) {
+        super(out);
+        this.logger = new ByteStreamLogger(logger, level, marker, charset);
+        this.fqcn = fqcn;
+    }
+
+    public LoggerFilterOutputStream(final OutputStream out, final ExtendedLogger logger, final Level level) {
+        this(out, Charset.defaultCharset(), logger, FQCN, level, null);
+    }
+
+    public LoggerFilterOutputStream(final OutputStream out, final ExtendedLogger logger, final Level level,
+            final Marker marker) {
+        this(out, Charset.defaultCharset(), logger, FQCN, level, marker);
+    }
+
+    @Override
+    public void close() throws IOException {
+        this.out.close();
+        this.logger.close(this.fqcn);
+    }
+
+    @Override
+    public void flush() throws IOException {
+        this.out.flush();
+    }
+
+    @Override
+    public String toString() {
+        return LoggerFilterOutputStream.class.getSimpleName() + "{stream=" + this.out + '}';
+    }
+
+    @Override
+    public void write(final byte[] b) throws IOException {
+        this.out.write(b);
+        this.logger.put(this.fqcn, b, 0, b.length);
+    }
+
+    @Override
+    public void write(final byte[] b, final int off, final int len) throws IOException {
+        this.out.write(b, off, len);
+        this.logger.put(this.fqcn, b, off, len);
+    }
+
+    @Override
+    public void write(final int b) throws IOException {
+        this.out.write(b);
+        this.logger.put(this.fqcn, (byte) (b & 0xFF));
+    }
+}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ffc1a38a/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/LoggerFilterWriter.java
----------------------------------------------------------------------
diff --git a/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/LoggerFilterWriter.java b/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/LoggerFilterWriter.java
new file mode 100644
index 0000000..a700f92
--- /dev/null
+++ b/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/LoggerFilterWriter.java
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.logging.log4j.io;
+
+import java.io.FilterWriter;
+import java.io.IOException;
+import java.io.Writer;
+
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.Marker;
+import org.apache.logging.log4j.spi.ExtendedLogger;
+import org.apache.logging.log4j.io.util.CharStreamLogger;
+
+/**
+ * Logs each line written to a pre-defined level. Can also be configured with a Marker. This class provides an interface
+ * that follows the {@link java.io.Writer} methods in spirit, but doesn't require output to any external out.
+ */
+public class LoggerFilterWriter extends FilterWriter {
+    private static final String FQCN = LoggerFilterWriter.class.getName();
+
+    private final CharStreamLogger logger;
+    private final String fqcn;
+
+    public LoggerFilterWriter(final Writer out, final ExtendedLogger logger, final Level level) {
+        this(out, logger, FQCN, level, null);
+    }
+
+    public LoggerFilterWriter(final Writer out, final ExtendedLogger logger, final Level level, final Marker marker) {
+        this(out, logger, FQCN, level, marker);
+    }
+
+    public LoggerFilterWriter(final Writer out, final ExtendedLogger logger, final String fqcn, final Level level,
+            final Marker marker) {
+        super(out);
+        this.logger = new CharStreamLogger(logger, level, marker);
+        this.fqcn = fqcn;
+    }
+
+    @Override
+    public void close() throws IOException {
+        this.out.close();
+        this.logger.close(this.fqcn);
+    }
+
+    @Override
+    public void flush() throws IOException {
+        this.out.flush();
+    }
+
+    @Override
+    public String toString() {
+        return LoggerFilterWriter.class.getSimpleName() + "{writer=" + this.out + '}';
+    }
+
+    @Override
+    public void write(final char[] cbuf) throws IOException {
+        this.out.write(cbuf);
+        this.logger.put(this.fqcn, cbuf, 0, cbuf.length);
+    }
+
+    @Override
+    public void write(final char[] cbuf, final int off, final int len) throws IOException {
+        this.out.write(cbuf, off, len);
+        this.logger.put(this.fqcn, cbuf, off, len);
+    }
+
+    @Override
+    public void write(final int c) throws IOException {
+        this.out.write(c);
+        this.logger.put(this.fqcn, (char) c);
+    }
+
+    @Override
+    public void write(final String str) throws IOException {
+        this.out.write(str);
+        this.logger.put(this.fqcn, str, 0, str.length());
+    }
+
+    @Override
+    public void write(final String str, final int off, final int len) throws IOException {
+        this.out.write(str, off, len);
+        this.logger.put(this.fqcn, str, off, len);
+    }
+}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ffc1a38a/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/LoggerInputStream.java
----------------------------------------------------------------------
diff --git a/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/LoggerInputStream.java b/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/LoggerInputStream.java
new file mode 100644
index 0000000..873723f
--- /dev/null
+++ b/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/LoggerInputStream.java
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.logging.log4j.io;
+
+import java.io.FilterInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.charset.Charset;
+
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.Marker;
+import org.apache.logging.log4j.spi.ExtendedLogger;
+import org.apache.logging.log4j.io.util.ByteStreamLogger;
+
+/**
+ * Logs each line read to a pre-defined level. Can also be configured with a Marker.
+ */
+public class LoggerInputStream extends FilterInputStream {
+    private static final String FQCN = LoggerInputStream.class.getName();
+
+    private final String fqcn;
+    private final ByteStreamLogger logger;
+
+    public LoggerInputStream(final InputStream in, final Charset charset, final ExtendedLogger logger, final Level level) {
+        this(in, charset, logger, FQCN, level, null);
+    }
+
+    public LoggerInputStream(final InputStream in, final Charset charset, final ExtendedLogger logger, final Level level,
+            final Marker marker) {
+        this(in, charset, logger, FQCN, level, marker);
+    }
+
+    public LoggerInputStream(final InputStream in, final Charset charset, final ExtendedLogger logger,
+            final String fqcn, final Level level, final Marker marker) {
+        super(in);
+        this.logger = new ByteStreamLogger(logger, level, marker, charset);
+        this.fqcn = fqcn;
+    }
+
+    public LoggerInputStream(final InputStream in, final ExtendedLogger logger, final Level level) {
+        this(in, Charset.defaultCharset(), logger, FQCN, level, null);
+    }
+
+    public LoggerInputStream(final InputStream in, final ExtendedLogger logger, final Level level, final Marker marker) {
+        this(in, Charset.defaultCharset(), logger, FQCN, level, marker);
+    }
+
+    @Override
+    public void close() throws IOException {
+        this.logger.close(this.fqcn);
+        super.close();
+    }
+
+    @Override
+    public int read() throws IOException {
+        final int b = super.read();
+        this.logger.put(this.fqcn, b);
+        return b;
+    }
+
+    @Override
+    public int read(final byte[] b) throws IOException {
+        return read(b, 0, b.length);
+    }
+
+    @Override
+    public int read(final byte[] b, final int off, final int len) throws IOException {
+        final int bytesRead = super.read(b, off, len);
+        this.logger.put(this.fqcn, b, off, bytesRead);
+        return bytesRead;
+    }
+
+    @Override
+    public String toString() {
+        return LoggerInputStream.class.getSimpleName() + "{stream=" + this.in + '}';
+    }
+}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ffc1a38a/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/LoggerOutputStream.java
----------------------------------------------------------------------
diff --git a/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/LoggerOutputStream.java b/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/LoggerOutputStream.java
new file mode 100644
index 0000000..f0ab698
--- /dev/null
+++ b/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/LoggerOutputStream.java
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.logging.log4j.io;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.nio.charset.Charset;
+
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.Marker;
+import org.apache.logging.log4j.spi.ExtendedLogger;
+import org.apache.logging.log4j.io.util.ByteStreamLogger;
+
+/**
+ * Logs each line written to a pre-defined level. Can also be configured with a Marker. This class provides an interface
+ * that follows the {@link java.io.OutputStream} methods in spirit, but doesn't require output to any external stream.
+ * This class should <em>not</em> be used as a stream for an underlying logger unless it's being used as a bridge.
+ * Otherwise, infinite loops may occur!
+ */
+public class LoggerOutputStream extends OutputStream {
+    private static final String FQCN = LoggerOutputStream.class.getName();
+
+    private final ByteStreamLogger logger;
+    private final String fqcn;
+
+    public LoggerOutputStream(final ExtendedLogger logger, final Level level) {
+        this(logger, level, null, Charset.defaultCharset(), FQCN);
+    }
+
+    public LoggerOutputStream(final ExtendedLogger logger, final Level level, final Charset charset) {
+        this(logger, level, null, charset, FQCN);
+    }
+
+    public LoggerOutputStream(final ExtendedLogger logger, final Level level, final Marker marker) {
+        this(logger, level, marker, Charset.defaultCharset(), FQCN);
+    }
+
+    public LoggerOutputStream(final ExtendedLogger logger, final Level level, final Marker marker, final Charset charset) {
+        this(logger, level, marker, charset, FQCN);
+    }
+
+    public LoggerOutputStream(final ExtendedLogger logger, final Level level, final Marker marker,
+            final Charset charset, final String fqcn) {
+        this.logger = new ByteStreamLogger(logger, level, marker, charset);
+        this.fqcn = fqcn;
+    }
+
+    @Override
+    public void close() throws IOException {
+        this.logger.close(this.fqcn);
+    }
+
+    @Override
+    public void flush() throws IOException {
+        // do nothing
+    }
+
+    @Override
+    public void write(final byte[] b) throws IOException {
+        this.logger.put(this.fqcn, b, 0, b.length);
+    }
+
+    @Override
+    public void write(final byte[] b, final int off, final int len) throws IOException {
+        this.logger.put(this.fqcn, b, off, len);
+    }
+
+    @Override
+    public void write(final int b) throws IOException {
+        this.logger.put(this.fqcn, (byte) (b & 0xFF));
+    }
+}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ffc1a38a/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/LoggerPrintStream.java
----------------------------------------------------------------------
diff --git a/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/LoggerPrintStream.java b/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/LoggerPrintStream.java
new file mode 100644
index 0000000..f5d51a5
--- /dev/null
+++ b/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/LoggerPrintStream.java
@@ -0,0 +1,284 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.logging.log4j.io;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.PrintStream;
+import java.io.UnsupportedEncodingException;
+import java.nio.charset.Charset;
+import java.util.Locale;
+
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.Marker;
+import org.apache.logging.log4j.spi.ExtendedLogger;
+
+/**
+ * Logs each line written to a pre-defined level. Can also be configured with a Marker. This class provides an interface
+ * that follows the {@link java.io.PrintStream} methods in spirit, but doesn't require output to any external stream.
+ * This class should <em>not</em> be used as a stream for an underlying logger unless it's being used as a bridge.
+ * Otherwise, infinite loops may occur!
+ */
+public class LoggerPrintStream extends PrintStream {
+    private static final String FQCN = LoggerPrintStream.class.getName();
+
+    public LoggerPrintStream(final ExtendedLogger logger, final boolean autoFlush, final Charset charset,
+            final String fqcn, final Level level, final Marker marker) throws UnsupportedEncodingException {
+        super(new LoggerOutputStream(logger, level, marker, charset, fqcn), autoFlush, charset.name());
+    }
+
+    public LoggerPrintStream(final ExtendedLogger logger, final Level level) throws UnsupportedEncodingException {
+        this(logger, false, Charset.defaultCharset(), FQCN, level, null);
+    }
+
+    public LoggerPrintStream(final ExtendedLogger logger, final Level level, final Charset charset)
+            throws UnsupportedEncodingException {
+        this(logger, false, charset, FQCN, level, null);
+    }
+
+    public LoggerPrintStream(final ExtendedLogger logger, final Level level, final Marker marker)
+            throws UnsupportedEncodingException {
+        this(logger, false, Charset.defaultCharset(), FQCN, level, marker);
+    }
+
+    public LoggerPrintStream(final ExtendedLogger logger, final Level level, final Marker marker, final Charset charset)
+            throws UnsupportedEncodingException {
+        this(logger, false, charset, FQCN, level, marker);
+    }
+
+    public LoggerPrintStream(final OutputStream out, final boolean autoFlush, final Charset charset,
+            final ExtendedLogger logger, final Level level) throws UnsupportedEncodingException {
+        this(out, autoFlush, charset, logger, FQCN, level, null);
+    }
+
+    public LoggerPrintStream(final OutputStream out, final boolean autoFlush, final Charset charset,
+            final ExtendedLogger logger, final Level level, final Marker marker) throws UnsupportedEncodingException {
+        this(out, autoFlush, charset, logger, FQCN, level, marker);
+    }
+
+    public LoggerPrintStream(final OutputStream out, final boolean autoFlush, final Charset charset,
+            final ExtendedLogger logger, final String fqcn, final Level level, final Marker marker)
+            throws UnsupportedEncodingException {
+        super(new LoggerFilterOutputStream(out, charset, logger, fqcn, level, marker), autoFlush, charset.name());
+    }
+
+    public LoggerPrintStream(final OutputStream out, final boolean autoFlush, final ExtendedLogger logger,
+            final Level level) {
+        this(out, autoFlush, logger, FQCN, level, null);
+    }
+
+    public LoggerPrintStream(final OutputStream out, final boolean autoFlush, final ExtendedLogger logger,
+            final Level level, final Marker marker) {
+        this(out, autoFlush, logger, FQCN, level, marker);
+    }
+
+    public LoggerPrintStream(final OutputStream out, final boolean autoFlush, final ExtendedLogger logger,
+            final String fqcn, final Level level, final Marker marker) {
+        super(new LoggerFilterOutputStream(out, Charset.defaultCharset(), logger, fqcn, level, marker), autoFlush);
+    }
+
+    public LoggerPrintStream(final OutputStream out, final Charset charset, final ExtendedLogger logger,
+            final Level level) throws UnsupportedEncodingException {
+        this(out, false, charset, logger, FQCN, level, null);
+    }
+
+    public LoggerPrintStream(final OutputStream out, final Charset charset, final ExtendedLogger logger,
+            final Level level, final Marker marker) throws UnsupportedEncodingException {
+        this(out, false, charset, logger, FQCN, level, marker);
+    }
+
+    public LoggerPrintStream(final OutputStream out, final ExtendedLogger logger, final Level level) {
+        this(out, false, logger, FQCN, level, null);
+    }
+
+    public LoggerPrintStream(final OutputStream out, final ExtendedLogger logger, final Level level, final Marker marker) {
+        this(out, false, logger, FQCN, level, marker);
+    }
+
+    @Override
+    public LoggerPrintStream append(final char c) {
+        super.append(c);
+        return this;
+    }
+
+    @Override
+    public LoggerPrintStream append(final CharSequence csq) {
+        super.append(csq);
+        return this;
+    }
+
+    @Override
+    public LoggerPrintStream append(final CharSequence csq, final int start, final int end) {
+        super.append(csq, start, end);
+        return this;
+    }
+
+    @Override
+    public boolean checkError() {
+        return super.checkError();
+    }
+
+    @Override
+    public void close() {
+        super.close();
+    }
+
+    @Override
+    public void flush() {
+        super.flush();
+    }
+
+    @Override
+    public LoggerPrintStream format(final Locale l, final String format, final Object... args) {
+        super.format(l, format, args);
+        return this;
+    }
+
+    @Override
+    public LoggerPrintStream format(final String format, final Object... args) {
+        super.format(format, args);
+        return this;
+    }
+
+    @Override
+    public void print(final boolean b) {
+        super.print(b);
+    }
+
+    @Override
+    public void print(final char c) {
+        super.print(c);
+    }
+
+    @Override
+    public void print(final char[] s) {
+        super.print(s);
+    }
+
+    @Override
+    public void print(final double d) {
+        super.print(d);
+    }
+
+    @Override
+    public void print(final float f) {
+        super.print(f);
+    }
+
+    @Override
+    public void print(final int i) {
+        super.print(i);
+    }
+
+    @Override
+    public void print(final long l) {
+        super.print(l);
+    }
+
+    @Override
+    public void print(final Object obj) {
+        super.print(obj);
+    }
+
+    @Override
+    public void print(final String s) {
+        super.print(s);
+    }
+
+    @Override
+    public LoggerPrintStream printf(final Locale l, final String format, final Object... args) {
+        super.printf(l, format, args);
+        return this;
+    }
+
+    @Override
+    public LoggerPrintStream printf(final String format, final Object... args) {
+        super.printf(format, args);
+        return this;
+    }
+
+    @Override
+    public void println() {
+        super.println();
+    }
+
+    @Override
+    public void println(final boolean x) {
+        super.println(x);
+    }
+
+    @Override
+    public void println(final char x) {
+        super.println(x);
+    }
+
+    @Override
+    public void println(final char[] x) {
+        super.println(x);
+    }
+
+    @Override
+    public void println(final double x) {
+        super.println(x);
+    }
+
+    @Override
+    public void println(final float x) {
+        super.println(x);
+    }
+
+    @Override
+    public void println(final int x) {
+        super.println(x);
+    }
+
+    @Override
+    public void println(final long x) {
+        super.println(x);
+    }
+
+    @Override
+    public void println(final Object x) {
+        super.println(x);
+    }
+
+    @Override
+    public void println(final String x) {
+        super.println(x);
+    }
+
+    @Override
+    public String toString() {
+        return LoggerPrintStream.class.getSimpleName() + "{stream=" + this.out + '}';
+    }
+
+    @Override
+    public void write(final byte[] b) throws IOException {
+        super.write(b);
+    }
+
+    @Override
+    public void write(final byte[] b, final int off, final int len) {
+        super.write(b, off, len);
+    }
+
+    @Override
+    public void write(final int b) {
+        super.write(b);
+    }
+}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ffc1a38a/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/LoggerPrintWriter.java
----------------------------------------------------------------------
diff --git a/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/LoggerPrintWriter.java b/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/LoggerPrintWriter.java
new file mode 100644
index 0000000..902c586
--- /dev/null
+++ b/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/LoggerPrintWriter.java
@@ -0,0 +1,258 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.logging.log4j.io;
+
+import java.io.PrintWriter;
+import java.io.Writer;
+import java.util.Locale;
+
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.Marker;
+import org.apache.logging.log4j.spi.ExtendedLogger;
+
+/**
+ * Logs each line written to a pre-defined level. Can also be configured with a Marker. This class provides an interface
+ * that follows the {@link java.io.PrintWriter} methods in spirit, but doesn't require output to any external writer.
+ * <p>
+ * Integration with JDBC logging can be as simple as:
+ * </p>
+ * <pre>DriverManager.setLogWriter(new LoggerPrintWriter((ExtendedLogger) LogManager.getLogger(), Level.DEBUG));
+ * </pre>
+ */
+public class LoggerPrintWriter extends PrintWriter {
+    private static final String FQCN = LoggerPrintWriter.class.getName();
+
+    @SuppressWarnings("resource")
+    public LoggerPrintWriter(final ExtendedLogger logger, final boolean autoFlush, final String fqcn,
+            final Level level, final Marker marker) {
+        super(new LoggerWriter(logger, fqcn, level, marker), autoFlush);
+    }
+
+    public LoggerPrintWriter(final ExtendedLogger logger, final Level level) {
+        this(logger, false, FQCN, level, null);
+    }
+
+    public LoggerPrintWriter(final ExtendedLogger logger, final Level level, final Marker marker) {
+        this(logger, false, FQCN, level, marker);
+    }
+
+    public LoggerPrintWriter(final Writer writer, final boolean autoFlush, final ExtendedLogger logger, final Level level) {
+        this(writer, autoFlush, logger, FQCN, level, null);
+    }
+
+    public LoggerPrintWriter(final Writer writer, final boolean autoFlush, final ExtendedLogger logger, final Level level,
+            final Marker marker) {
+        this(writer, autoFlush, logger, FQCN, level, marker);
+    }
+
+    @SuppressWarnings("resource")
+    public LoggerPrintWriter(final Writer writer, final boolean autoFlush, final ExtendedLogger logger,
+            final String fqcn, final Level level, final Marker marker) {
+        super(new LoggerFilterWriter(writer, logger, fqcn, level, marker), autoFlush);
+    }
+
+    public LoggerPrintWriter(final Writer writer, final ExtendedLogger logger, final Level level) {
+        this(writer, false, logger, FQCN, level, null);
+    }
+
+    public LoggerPrintWriter(final Writer writer, final ExtendedLogger logger, final Level level, final Marker marker) {
+        this(writer, false, logger, FQCN, level, marker);
+    }
+
+    @Override
+    public LoggerPrintWriter append(final char c) {
+        super.append(c);
+        return this;
+    }
+
+    @Override
+    public LoggerPrintWriter append(final CharSequence csq) {
+        super.append(csq);
+        return this;
+    }
+
+    @Override
+    public LoggerPrintWriter append(final CharSequence csq, final int start, final int end) {
+        super.append(csq, start, end);
+        return this;
+    }
+
+    @Override
+    public boolean checkError() {
+        return super.checkError();
+    }
+
+    @Override
+    public void close() {
+        super.close();
+    }
+
+    @Override
+    public void flush() {
+        super.flush();
+    }
+
+    @Override
+    public LoggerPrintWriter format(final Locale l, final String format, final Object... args) {
+        super.format(l, format, args);
+        return this;
+    }
+
+    @Override
+    public LoggerPrintWriter format(final String format, final Object... args) {
+        super.format(format, args);
+        return this;
+    }
+
+    @Override
+    public void print(final boolean b) {
+        super.print(b);
+    }
+
+    @Override
+    public void print(final char c) {
+        super.print(c);
+    }
+
+    @Override
+    public void print(final char[] s) {
+        super.print(s);
+    }
+
+    @Override
+    public void print(final double d) {
+        super.print(d);
+    }
+
+    @Override
+    public void print(final float f) {
+        super.print(f);
+    }
+
+    @Override
+    public void print(final int i) {
+        super.print(i);
+    }
+
+    @Override
+    public void print(final long l) {
+        super.print(l);
+    }
+
+    @Override
+    public void print(final Object obj) {
+        super.print(obj);
+    }
+
+    @Override
+    public void print(final String s) {
+        super.print(s);
+    }
+
+    @Override
+    public LoggerPrintWriter printf(final Locale l, final String format, final Object... args) {
+        super.printf(l, format, args);
+        return this;
+    }
+
+    @Override
+    public LoggerPrintWriter printf(final String format, final Object... args) {
+        super.printf(format, args);
+        return this;
+    }
+
+    @Override
+    public void println() {
+        super.println();
+    }
+
+    @Override
+    public void println(final boolean x) {
+        super.println(x);
+    }
+
+    @Override
+    public void println(final char x) {
+        super.println(x);
+    }
+
+    @Override
+    public void println(final char[] x) {
+        super.println(x);
+    }
+
+    @Override
+    public void println(final double x) {
+        super.println(x);
+    }
+
+    @Override
+    public void println(final float x) {
+        super.println(x);
+    }
+
+    @Override
+    public void println(final int x) {
+        super.println(x);
+    }
+
+    @Override
+    public void println(final long x) {
+        super.println(x);
+    }
+
+    @Override
+    public void println(final Object x) {
+        super.println(x);
+    }
+
+    @Override
+    public void println(final String x) {
+        super.println(x);
+    }
+
+    @Override
+    public String toString() {
+        return LoggerPrintWriter.class.getSimpleName() + "{stream=" + this.out + '}';
+    }
+
+    @Override
+    public void write(final char[] buf) {
+        super.write(buf);
+    }
+
+    @Override
+    public void write(final char[] buf, final int off, final int len) {
+        super.write(buf, off, len);
+    }
+
+    @Override
+    public void write(final int c) {
+        super.write(c);
+    }
+
+    @Override
+    public void write(final String s) {
+        super.write(s);
+    }
+
+    @Override
+    public void write(final String s, final int off, final int len) {
+        super.write(s, off, len);
+    }
+}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ffc1a38a/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/LoggerReader.java
----------------------------------------------------------------------
diff --git a/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/LoggerReader.java b/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/LoggerReader.java
new file mode 100644
index 0000000..658a988
--- /dev/null
+++ b/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/LoggerReader.java
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.logging.log4j.io;
+
+import java.io.FilterReader;
+import java.io.IOException;
+import java.io.Reader;
+import java.nio.CharBuffer;
+
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.Marker;
+import org.apache.logging.log4j.spi.ExtendedLogger;
+import org.apache.logging.log4j.io.util.CharStreamLogger;
+
+/**
+ * Logs each line written to a pre-defined level. Can also be configured with a Marker. This class provides an interface
+ * that follows the {@link java.io.Writer} methods in spirit, but doesn't require output to any external writer.
+ */
+public class LoggerReader extends FilterReader {
+    private static final String FQCN = LoggerReader.class.getName();
+
+    private final CharStreamLogger logger;
+    private final String fqcn;
+
+    public LoggerReader(final Reader reader, final ExtendedLogger logger, final Level level) {
+        this(reader, logger, FQCN, level, null);
+    }
+
+    public LoggerReader(final Reader reader, final ExtendedLogger logger, final Level level, final Marker marker) {
+        this(reader, logger, FQCN, level, marker);
+    }
+
+    public LoggerReader(final Reader reader, final ExtendedLogger logger, final String fqcn, final Level level,
+            final Marker marker) {
+        super(reader);
+        this.logger = new CharStreamLogger(logger, level, marker);
+        this.fqcn = fqcn;
+    }
+
+    @Override
+    public void close() throws IOException {
+        super.close();
+        this.logger.close(this.fqcn);
+    }
+
+    @Override
+    public int read() throws IOException {
+        final int c = super.read();
+        this.logger.put(this.fqcn, c);
+        return c;
+    }
+
+    @Override
+    public int read(final char[] cbuf) throws IOException {
+        return read(cbuf, 0, cbuf.length);
+    }
+
+    @Override
+    public int read(final char[] cbuf, final int off, final int len) throws IOException {
+        final int charsRead = super.read(cbuf, off, len);
+        this.logger.put(this.fqcn, cbuf, off, charsRead);
+        return charsRead;
+    }
+
+    @Override
+    public int read(final CharBuffer target) throws IOException {
+        final int len = target.remaining();
+        final char[] cbuf = new char[len];
+        final int charsRead = read(cbuf, 0, len);
+        if (charsRead > 0) {
+            target.put(cbuf, 0, charsRead);
+        }
+        return charsRead;
+    }
+
+    @Override
+    public String toString() {
+        return LoggerReader.class.getSimpleName() + "{stream=" + this.in + '}';
+    }
+}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ffc1a38a/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/LoggerStreams.java
----------------------------------------------------------------------
diff --git a/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/LoggerStreams.java b/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/LoggerStreams.java
new file mode 100644
index 0000000..6378d19
--- /dev/null
+++ b/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/LoggerStreams.java
@@ -0,0 +1,170 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.logging.log4j.io;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.Reader;
+import java.io.UnsupportedEncodingException;
+import java.io.Writer;
+import java.nio.charset.Charset;
+
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.Marker;
+import org.apache.logging.log4j.spi.ExtendedLogger;
+
+public class LoggerStreams {
+
+    public static class BufferedBuilder {
+        private final ExtendedLogger logger;
+        private final Level level;
+        private final Marker marker;
+        private final int size;
+
+        BufferedBuilder(final ExtendedLogger logger, final Level level, final Marker marker, final int size) {
+            this.logger = logger;
+            this.level = level;
+            this.marker = marker;
+            this.size = size;
+        }
+
+        public LoggerBufferedInputStream create(final InputStream in) {
+            if (this.size > 0) {
+                return new LoggerBufferedInputStream(in, this.size, this.logger, this.level, this.marker);
+            }
+            return new LoggerBufferedInputStream(in, this.logger, this.level, this.marker);
+        }
+
+        public LoggerBufferedInputStream create(final InputStream in, final Charset charset) {
+            if (this.size > 0) {
+                return new LoggerBufferedInputStream(in, charset, this.size, this.logger, this.level, this.marker);
+            }
+            return new LoggerBufferedInputStream(in, charset, this.logger, this.level, this.marker);
+        }
+
+        public LoggerBufferedReader create(final Reader reader) {
+            if (this.size > 0) {
+                return new LoggerBufferedReader(reader, this.size, this.logger, this.level, this.marker);
+            }
+            return new LoggerBufferedReader(reader, this.logger, this.level, this.marker);
+        }
+
+        public BufferedBuilder marker(final Marker marker) {
+            return new BufferedBuilder(this.logger, this.level, marker, this.size);
+        }
+
+        public BufferedBuilder size(final int size) {
+            return new BufferedBuilder(this.logger, this.level, this.marker, size);
+        }
+    }
+
+    public static class Builder {
+        private final ExtendedLogger logger;
+        private final Level level;
+        private final Marker marker;
+
+        Builder(final ExtendedLogger logger, final Level level, final Marker marker) {
+            this.logger = logger;
+            this.level = level;
+            this.marker = marker;
+        }
+
+        public BufferedBuilder buffered() {
+            return new BufferedBuilder(this.logger, this.level, this.marker, 0);
+        }
+
+        public LoggerFilterWriter create(final Writer writer) {
+            return new LoggerFilterWriter(writer, this.logger, this.level, this.marker);
+        }
+
+        public Builder marker(final Marker marker) {
+            return new Builder(this.logger, this.level, marker);
+        }
+
+        public PrintingBuilder printing() {
+            return new PrintingBuilder(this.logger, this.level, this.marker, false);
+        }
+    }
+
+    public static class PrintingBuilder {
+        private final ExtendedLogger logger;
+        private final Level level;
+        private final Marker marker;
+        private final boolean autoFlush;
+
+        PrintingBuilder(final ExtendedLogger logger, final Level level, final Marker marker, final boolean autoFlush) {
+            this.logger = logger;
+            this.level = level;
+            this.marker = marker;
+            this.autoFlush = autoFlush;
+        }
+
+        public PrintingBuilder autoFlush() {
+            return autoFlush(true);
+        }
+
+        public PrintingBuilder autoFlush(final boolean autoFlush) {
+            return new PrintingBuilder(this.logger, this.level, this.marker, autoFlush);
+        }
+
+        public LoggerPrintStream create(final OutputStream out) {
+            return new LoggerPrintStream(out, this.autoFlush, this.logger, this.level, this.marker);
+        }
+
+        public LoggerPrintStream create(final OutputStream out, final Charset charset) {
+            try {
+                return new LoggerPrintStream(out, this.autoFlush, charset, this.logger, this.level, this.marker);
+            } catch (final UnsupportedEncodingException e) {
+                // Should never occur because the constructor must throw this
+                throw new IllegalArgumentException("Invalid charset", e);
+            }
+        }
+
+        public LoggerPrintWriter create(final Writer writer) {
+            return new LoggerPrintWriter(writer, this.autoFlush, this.logger, this.level, this.marker);
+        }
+
+        public PrintingBuilder marker(final Marker marker) {
+            return new PrintingBuilder(this.logger, this.level, marker, this.autoFlush);
+        }
+    }
+
+    public static Builder debug(final ExtendedLogger logger) {
+        return new Builder(logger, Level.DEBUG, null);
+    }
+
+    public static Builder error(final ExtendedLogger logger) {
+        return new Builder(logger, Level.ERROR, null);
+    }
+
+    public static Builder fatal(final ExtendedLogger logger) {
+        return new Builder(logger, Level.FATAL, null);
+    }
+
+    public static Builder info(final ExtendedLogger logger) {
+        return new Builder(logger, Level.INFO, null);
+    }
+
+    public static Builder trace(final ExtendedLogger logger) {
+        return new Builder(logger, Level.TRACE, null);
+    }
+
+    public static Builder warn(final ExtendedLogger logger) {
+        return new Builder(logger, Level.WARN, null);
+    }
+}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ffc1a38a/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/LoggerWriter.java
----------------------------------------------------------------------
diff --git a/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/LoggerWriter.java b/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/LoggerWriter.java
new file mode 100644
index 0000000..70118e8
--- /dev/null
+++ b/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/LoggerWriter.java
@@ -0,0 +1,90 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.logging.log4j.io;
+
+import java.io.IOException;
+import java.io.Writer;
+
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.Marker;
+import org.apache.logging.log4j.spi.ExtendedLogger;
+import org.apache.logging.log4j.io.util.CharStreamLogger;
+
+/**
+ * Logs each line written to a pre-defined level. Can also be configured with a Marker. This class provides an interface
+ * that follows the {@link java.io.Writer} methods in spirit, but doesn't require output to any external writer.
+ */
+public class LoggerWriter extends Writer {
+    private static final String FQCN = LoggerWriter.class.getName();
+
+    private final CharStreamLogger logger;
+    private final String fqcn;
+
+    public LoggerWriter(final ExtendedLogger logger, final Level level) {
+        this(logger, FQCN, level, null);
+    }
+
+    public LoggerWriter(final ExtendedLogger logger, final Level level, final Marker marker) {
+        this(logger, FQCN, level, marker);
+    }
+
+    public LoggerWriter(final ExtendedLogger logger, final String fqcn, final Level level, final Marker marker) {
+        this.logger = new CharStreamLogger(logger, level, marker);
+        this.fqcn = fqcn;
+    }
+
+    @Override
+    public void close() throws IOException {
+        this.logger.close(this.fqcn);
+    }
+
+    @Override
+    public void flush() throws IOException {
+        // do nothing
+    }
+
+    @Override
+    public String toString() {
+        return this.getClass().getSimpleName() + "[fqcn=" + this.fqcn + ", logger=" + this.logger + "]";
+    }
+
+    @Override
+    public void write(final char[] cbuf) throws IOException {
+        this.logger.put(this.fqcn, cbuf, 0, cbuf.length);
+    }
+
+    @Override
+    public void write(final char[] cbuf, final int off, final int len) throws IOException {
+        this.logger.put(this.fqcn, cbuf, off, len);
+    }
+
+    @Override
+    public void write(final int c) throws IOException {
+        this.logger.put(this.fqcn, (char) c);
+    }
+
+    @Override
+    public void write(final String str) throws IOException {
+        this.logger.put(this.fqcn, str, 0, str.length());
+    }
+
+    @Override
+    public void write(final String str, final int off, final int len) throws IOException {
+        this.logger.put(this.fqcn, str, off, len);
+    }
+}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ffc1a38a/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/util/ByteStreamLogger.java
----------------------------------------------------------------------
diff --git a/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/util/ByteStreamLogger.java b/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/util/ByteStreamLogger.java
new file mode 100644
index 0000000..bbba82e
--- /dev/null
+++ b/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/util/ByteStreamLogger.java
@@ -0,0 +1,152 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.logging.log4j.io.util;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.nio.ByteBuffer;
+import java.nio.charset.Charset;
+
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.Marker;
+import org.apache.logging.log4j.spi.ExtendedLogger;
+
+public class ByteStreamLogger {
+    private class ByteBufferInputStream extends InputStream {
+
+        @Override
+        public int read() throws IOException {
+            ByteStreamLogger.this.buf.flip();
+            int result = -1;
+            if (ByteStreamLogger.this.buf.limit() > 0) {
+                result = ByteStreamLogger.this.buf.get() & 0xFF;
+            }
+            ByteStreamLogger.this.buf.compact();
+            return result;
+        }
+
+        @Override
+        public int read(final byte[] bytes, final int off, final int len) throws IOException {
+            ByteStreamLogger.this.buf.flip();
+            int result = -1;
+            if (ByteStreamLogger.this.buf.limit() > 0) {
+                result = Math.min(len, ByteStreamLogger.this.buf.limit());
+                ByteStreamLogger.this.buf.get(bytes, off, result);
+            }
+            ByteStreamLogger.this.buf.compact();
+            return result;
+        }
+    }
+
+    private static final int BUFFER_SIZE = 1024;
+    private final ExtendedLogger logger;
+    private final Level level;
+    private final Marker marker;
+    private final ByteBufferInputStream inputStream;
+    private final InputStreamReader reader;
+    private final char[] msgBuf = new char[BUFFER_SIZE];
+    private final StringBuilder msg = new StringBuilder();
+    private boolean closed;
+
+    private final ByteBuffer buf = ByteBuffer.allocate(BUFFER_SIZE);
+
+    public ByteStreamLogger(final ExtendedLogger logger, final Level level, final Marker marker, final Charset charset) {
+        this.logger = logger;
+        this.level = level;
+        this.marker = marker;
+        this.inputStream = new ByteBufferInputStream();
+        this.reader = new InputStreamReader(this.inputStream, charset);
+    }
+
+    public void close(final String fqcn) {
+        synchronized (this.msg) {
+            this.closed = true;
+            logEnd(fqcn);
+//            in.close();
+        }
+    }
+
+    private void extractMessages(final String fqcn) throws IOException {
+        if (this.closed) {
+            return;
+        }
+        int read = this.reader.read(this.msgBuf);
+        while (read > 0) {
+            int off = 0;
+            for (int pos = 0; pos < read; pos++) {
+                switch (this.msgBuf[pos]) {
+                case '\r':
+                    this.msg.append(this.msgBuf, off, pos - off);
+                    off = pos + 1;
+                    break;
+                case '\n':
+                    this.msg.append(this.msgBuf, off, pos - off);
+                    off = pos + 1;
+                    log(fqcn);
+                    break;
+                }
+            }
+            this.msg.append(this.msgBuf, off, read - off);
+            read = this.reader.read(this.msgBuf);
+        }
+    }
+
+    private void log(final String fqcn) {
+        // convert to string now so async loggers work
+        this.logger.logIfEnabled(fqcn, this.level, this.marker, this.msg.toString());
+        this.msg.setLength(0);
+    }
+    
+    private void logEnd(final String fqcn) {
+        if (this.msg.length() > 0) {
+            log(fqcn);
+        }
+    }
+
+    public void put(final String fqcn, final byte[] b, final int off, final int len) throws IOException {
+        int curOff = off;
+        int curLen = len;
+        if (curLen >= 0) {
+            synchronized (this.msg) {
+                while (curLen > this.buf.remaining()) {
+                    final int remaining = this.buf.remaining();
+                    this.buf.put(b, curOff, remaining);
+                    curLen -= remaining;
+                    curOff += remaining;
+                    extractMessages(fqcn);
+                }
+                this.buf.put(b, curOff, curLen);
+                extractMessages(fqcn);
+            }
+        } else {
+            logEnd(fqcn);
+        }
+    }
+
+    public void put(final String fqcn, final int b) throws IOException {
+        if (b >= 0) {
+            synchronized (this.msg) {
+                this.buf.put((byte) (b & 0xFF));
+                extractMessages(fqcn);
+            }
+        } else {
+            logEnd(fqcn);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ffc1a38a/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/util/CharStreamLogger.java
----------------------------------------------------------------------
diff --git a/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/util/CharStreamLogger.java b/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/util/CharStreamLogger.java
new file mode 100644
index 0000000..6107796
--- /dev/null
+++ b/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/util/CharStreamLogger.java
@@ -0,0 +1,110 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.logging.log4j.io.util;
+
+import java.nio.CharBuffer;
+
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.Marker;
+import org.apache.logging.log4j.spi.ExtendedLogger;
+
+public class CharStreamLogger {
+    private final ExtendedLogger logger;
+    private final Level level;
+    private final Marker marker;
+    private final StringBuilder msg = new StringBuilder();
+    private boolean closed = false;
+
+    public CharStreamLogger(final ExtendedLogger logger, final Level level, final Marker marker) {
+        this.logger = logger;
+        this.level = level;
+        this.marker = marker;
+    }
+
+    public void close(final String fqcn) {
+        synchronized (this.msg) {
+            this.closed = true;
+            logEnd(fqcn);
+        }
+    }
+
+    private void log(final String fqcn) {
+        // convert to string now so async loggers work
+        this.logger.logIfEnabled(fqcn, this.level, this.marker, this.msg.toString());
+        this.msg.setLength(0);
+    }
+
+    private void logEnd(final String fqcn) {
+        if (this.msg.length() > 0) {
+            log(fqcn);
+        }
+    }
+
+    public void put(final String fqcn, final char[] cbuf, final int off, final int len) {
+        put(fqcn, CharBuffer.wrap(cbuf), off, len);
+    }
+
+    public void put(final String fqcn, final CharSequence str, final int off, final int len) {
+        if (len >= 0) {
+            synchronized (this.msg) {
+                if (this.closed) {
+                    return;
+                }
+                int start = off;
+                final int end = off + len;
+                for (int pos = off; pos < end; pos++) {
+                    final char c = str.charAt(pos);
+                    switch (c) {
+                    case '\r':
+                    case '\n':
+                        this.msg.append(str, start, pos);
+                        start = pos + 1;
+                        if (c == '\n') {
+                            log(fqcn);
+                        }
+                        break;
+                    }
+                }
+                this.msg.append(str, start, end);
+            }
+        } else {
+            logEnd(fqcn);
+        }
+    }
+
+    public void put(final String fqcn, final int c) {
+        if (c >= 0) {
+            synchronized (this.msg) {
+                if (this.closed) {
+                    return;
+                }
+                switch (c) {
+                case '\n':
+                    log(fqcn);
+                    break;
+                case '\r':
+                    break;
+                default:
+                    this.msg.append((char) c);
+                }
+            }
+        } else {
+            logEnd(fqcn);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ffc1a38a/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/AbstractLoggerOutputStreamTest.java
----------------------------------------------------------------------
diff --git a/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/AbstractLoggerOutputStreamTest.java b/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/AbstractLoggerOutputStreamTest.java
new file mode 100644
index 0000000..a41b6dd
--- /dev/null
+++ b/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/AbstractLoggerOutputStreamTest.java
@@ -0,0 +1,138 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.logging.log4j.io;
+
+import static org.easymock.EasyMock.replay;
+import static org.easymock.EasyMock.verify;
+import static org.junit.Assert.assertEquals;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+
+import org.easymock.EasyMock;
+import org.junit.Before;
+import org.junit.Test;
+
+public abstract class AbstractLoggerOutputStreamTest extends AbstractStreamTest {
+    protected OutputStream out;
+    protected ByteArrayOutputStream wrapped;
+
+    protected abstract ByteArrayOutputStream createOutputStream();
+
+    protected abstract OutputStream createOutputStreamWrapper();
+
+    @Before
+    public void createStream() {
+        this.wrapped = createOutputStream();
+        this.out = createOutputStreamWrapper();
+    }
+
+    @Test
+    public void testClose_HasRemainingData() throws IOException {
+        this.out.write(FIRST.getBytes());
+        assertMessages();
+        this.out.close();
+        assertMessages(FIRST);
+        if (this.wrapped != null) {
+            assertEquals(FIRST, this.wrapped.toString());
+        }
+    }
+
+    @Test
+    public void testClose_NoRemainingData() throws IOException {
+        this.out.close();
+        assertMessages();
+        if (this.wrapped != null) {
+            assertEquals("", this.wrapped.toString());
+        }
+    }
+
+    @Test
+    public void testFlush() throws IOException {
+        final OutputStream out = EasyMock.createMock("out", OutputStream.class);
+        out.flush(); // expect the flush to come through to the mocked OutputStream
+        out.close();
+        replay(out);
+
+        final LoggerFilterOutputStream los = new LoggerFilterOutputStream(out, getExtendedLogger(), LEVEL);
+        los.flush();
+        los.close();
+        verify(out);
+    }
+
+    @Test
+    public void testWrite_ByteArray() throws Exception {
+        final byte[] bytes = "byte[]".getBytes();
+        this.out.write(bytes);
+        assertMessages();
+        this.out.write('\n');
+        assertMessages("byte[]");
+        if (this.wrapped != null) {
+            assertEquals("byte[]\n", this.wrapped.toString());
+        }
+    }
+
+    @Test
+    public void testWrite_ByteArray_Offset_Length() throws Exception {
+        final byte[] bytes = "byte[]".getBytes();
+        final int middle = bytes.length / 2;
+        final int length = bytes.length - middle;
+        final String right = new String(bytes, middle, length);
+        this.out.write(bytes, middle, length);
+        assertMessages();
+        this.out.write('\n');
+        assertMessages(right);
+        if (this.wrapped != null) {
+            assertEquals("byte[]".substring(middle, bytes.length) + '\n', this.wrapped.toString());
+        }
+    }
+
+    @Test
+    public void testWrite_IgnoresWindowsNewline() throws IOException {
+        this.out.write(FIRST.getBytes());
+        this.out.write("\r\n".getBytes());
+        this.out.write(LAST.getBytes());
+        this.out.close();
+        assertMessages(FIRST, LAST);
+        if (this.wrapped != null) {
+            assertEquals(FIRST + "\r\n" + LAST, this.wrapped.toString());
+        }
+    }
+
+    @Test
+    public void testWrite_Int() throws Exception {
+        for (final byte b : "int".getBytes()) {
+            this.out.write(b);
+            assertMessages();
+        }
+        this.out.write('\n');
+        assertMessages("int");
+        if (this.wrapped != null) {
+            assertEquals("int" + '\n', this.wrapped.toString());
+        }
+    }
+
+    @Test
+    public void testWrite_MultipleLines() throws IOException {
+        this.out.write((FIRST + '\n' + LAST + '\n').getBytes());
+        assertMessages(FIRST, LAST);
+        if (this.wrapped != null) {
+            assertEquals(FIRST + '\n' + LAST + '\n', this.wrapped.toString());
+        }
+    }
+}


[2/6] Rename log4j-streams to log4j-iostreams.

Posted by ma...@apache.org.
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ffc1a38a/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerFilterOutputStream.java
----------------------------------------------------------------------
diff --git a/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerFilterOutputStream.java b/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerFilterOutputStream.java
deleted file mode 100644
index 96ab4e1..0000000
--- a/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerFilterOutputStream.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.logging.log4j.streams;
-
-import java.io.FilterOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.nio.charset.Charset;
-
-import org.apache.logging.log4j.Level;
-import org.apache.logging.log4j.Marker;
-import org.apache.logging.log4j.spi.ExtendedLogger;
-import org.apache.logging.log4j.streams.util.ByteStreamLogger;
-
-/**
- * Logs each line written to a pre-defined level. Can also be configured with a Marker. This class provides an interface
- * that follows the {@link java.io.OutputStream} methods in spirit, but doesn't require output to any external stream.
- * This class should <em>not</em> be used as a stream for an underlying logger unless it's being used as a bridge.
- * Otherwise, infinite loops may occur!
- */
-public class LoggerFilterOutputStream extends FilterOutputStream {
-    private static final String FQCN = LoggerFilterOutputStream.class.getName();
-
-    private final ByteStreamLogger logger;
-    private final String fqcn;
-
-    public LoggerFilterOutputStream(final OutputStream out, final Charset charset, final ExtendedLogger logger,
-            final Level level) {
-        this(out, charset, logger, FQCN, level, null);
-    }
-
-    public LoggerFilterOutputStream(final OutputStream out, final Charset charset, final ExtendedLogger logger,
-            final Level level, final Marker marker) {
-        this(out, charset, logger, FQCN, level, marker);
-    }
-
-    public LoggerFilterOutputStream(final OutputStream out, final Charset charset, final ExtendedLogger logger,
-            final String fqcn, final Level level, final Marker marker) {
-        super(out);
-        this.logger = new ByteStreamLogger(logger, level, marker, charset);
-        this.fqcn = fqcn;
-    }
-
-    public LoggerFilterOutputStream(final OutputStream out, final ExtendedLogger logger, final Level level) {
-        this(out, Charset.defaultCharset(), logger, FQCN, level, null);
-    }
-
-    public LoggerFilterOutputStream(final OutputStream out, final ExtendedLogger logger, final Level level,
-            final Marker marker) {
-        this(out, Charset.defaultCharset(), logger, FQCN, level, marker);
-    }
-
-    @Override
-    public void close() throws IOException {
-        this.out.close();
-        this.logger.close(this.fqcn);
-    }
-
-    @Override
-    public void flush() throws IOException {
-        this.out.flush();
-    }
-
-    @Override
-    public String toString() {
-        return LoggerFilterOutputStream.class.getSimpleName() + "{stream=" + this.out + '}';
-    }
-
-    @Override
-    public void write(final byte[] b) throws IOException {
-        this.out.write(b);
-        this.logger.put(this.fqcn, b, 0, b.length);
-    }
-
-    @Override
-    public void write(final byte[] b, final int off, final int len) throws IOException {
-        this.out.write(b, off, len);
-        this.logger.put(this.fqcn, b, off, len);
-    }
-
-    @Override
-    public void write(final int b) throws IOException {
-        this.out.write(b);
-        this.logger.put(this.fqcn, (byte) (b & 0xFF));
-    }
-}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ffc1a38a/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerFilterWriter.java
----------------------------------------------------------------------
diff --git a/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerFilterWriter.java b/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerFilterWriter.java
deleted file mode 100644
index 2659c04..0000000
--- a/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerFilterWriter.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.logging.log4j.streams;
-
-import java.io.FilterWriter;
-import java.io.IOException;
-import java.io.Writer;
-
-import org.apache.logging.log4j.Level;
-import org.apache.logging.log4j.Marker;
-import org.apache.logging.log4j.spi.ExtendedLogger;
-import org.apache.logging.log4j.streams.util.CharStreamLogger;
-
-/**
- * Logs each line written to a pre-defined level. Can also be configured with a Marker. This class provides an interface
- * that follows the {@link java.io.Writer} methods in spirit, but doesn't require output to any external out.
- */
-public class LoggerFilterWriter extends FilterWriter {
-    private static final String FQCN = LoggerFilterWriter.class.getName();
-
-    private final CharStreamLogger logger;
-    private final String fqcn;
-
-    public LoggerFilterWriter(final Writer out, final ExtendedLogger logger, final Level level) {
-        this(out, logger, FQCN, level, null);
-    }
-
-    public LoggerFilterWriter(final Writer out, final ExtendedLogger logger, final Level level, final Marker marker) {
-        this(out, logger, FQCN, level, marker);
-    }
-
-    public LoggerFilterWriter(final Writer out, final ExtendedLogger logger, final String fqcn, final Level level,
-            final Marker marker) {
-        super(out);
-        this.logger = new CharStreamLogger(logger, level, marker);
-        this.fqcn = fqcn;
-    }
-
-    @Override
-    public void close() throws IOException {
-        this.out.close();
-        this.logger.close(this.fqcn);
-    }
-
-    @Override
-    public void flush() throws IOException {
-        this.out.flush();
-    }
-
-    @Override
-    public String toString() {
-        return LoggerFilterWriter.class.getSimpleName() + "{writer=" + this.out + '}';
-    }
-
-    @Override
-    public void write(final char[] cbuf) throws IOException {
-        this.out.write(cbuf);
-        this.logger.put(this.fqcn, cbuf, 0, cbuf.length);
-    }
-
-    @Override
-    public void write(final char[] cbuf, final int off, final int len) throws IOException {
-        this.out.write(cbuf, off, len);
-        this.logger.put(this.fqcn, cbuf, off, len);
-    }
-
-    @Override
-    public void write(final int c) throws IOException {
-        this.out.write(c);
-        this.logger.put(this.fqcn, (char) c);
-    }
-
-    @Override
-    public void write(final String str) throws IOException {
-        this.out.write(str);
-        this.logger.put(this.fqcn, str, 0, str.length());
-    }
-
-    @Override
-    public void write(final String str, final int off, final int len) throws IOException {
-        this.out.write(str, off, len);
-        this.logger.put(this.fqcn, str, off, len);
-    }
-}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ffc1a38a/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerInputStream.java
----------------------------------------------------------------------
diff --git a/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerInputStream.java b/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerInputStream.java
deleted file mode 100644
index 64eb202..0000000
--- a/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerInputStream.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.logging.log4j.streams;
-
-import java.io.FilterInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.nio.charset.Charset;
-
-import org.apache.logging.log4j.Level;
-import org.apache.logging.log4j.Marker;
-import org.apache.logging.log4j.spi.ExtendedLogger;
-import org.apache.logging.log4j.streams.util.ByteStreamLogger;
-
-/**
- * Logs each line read to a pre-defined level. Can also be configured with a Marker.
- */
-public class LoggerInputStream extends FilterInputStream {
-    private static final String FQCN = LoggerInputStream.class.getName();
-
-    private final String fqcn;
-    private final ByteStreamLogger logger;
-
-    public LoggerInputStream(final InputStream in, final Charset charset, final ExtendedLogger logger, final Level level) {
-        this(in, charset, logger, FQCN, level, null);
-    }
-
-    public LoggerInputStream(final InputStream in, final Charset charset, final ExtendedLogger logger, final Level level,
-            final Marker marker) {
-        this(in, charset, logger, FQCN, level, marker);
-    }
-
-    public LoggerInputStream(final InputStream in, final Charset charset, final ExtendedLogger logger,
-            final String fqcn, final Level level, final Marker marker) {
-        super(in);
-        this.logger = new ByteStreamLogger(logger, level, marker, charset);
-        this.fqcn = fqcn;
-    }
-
-    public LoggerInputStream(final InputStream in, final ExtendedLogger logger, final Level level) {
-        this(in, Charset.defaultCharset(), logger, FQCN, level, null);
-    }
-
-    public LoggerInputStream(final InputStream in, final ExtendedLogger logger, final Level level, final Marker marker) {
-        this(in, Charset.defaultCharset(), logger, FQCN, level, marker);
-    }
-
-    @Override
-    public void close() throws IOException {
-        this.logger.close(this.fqcn);
-        super.close();
-    }
-
-    @Override
-    public int read() throws IOException {
-        final int b = super.read();
-        this.logger.put(this.fqcn, b);
-        return b;
-    }
-
-    @Override
-    public int read(final byte[] b) throws IOException {
-        return read(b, 0, b.length);
-    }
-
-    @Override
-    public int read(final byte[] b, final int off, final int len) throws IOException {
-        final int bytesRead = super.read(b, off, len);
-        this.logger.put(this.fqcn, b, off, bytesRead);
-        return bytesRead;
-    }
-
-    @Override
-    public String toString() {
-        return LoggerInputStream.class.getSimpleName() + "{stream=" + this.in + '}';
-    }
-}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ffc1a38a/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerOutputStream.java
----------------------------------------------------------------------
diff --git a/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerOutputStream.java b/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerOutputStream.java
deleted file mode 100644
index 836a20b..0000000
--- a/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerOutputStream.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.logging.log4j.streams;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.nio.charset.Charset;
-
-import org.apache.logging.log4j.Level;
-import org.apache.logging.log4j.Marker;
-import org.apache.logging.log4j.spi.ExtendedLogger;
-import org.apache.logging.log4j.streams.util.ByteStreamLogger;
-
-/**
- * Logs each line written to a pre-defined level. Can also be configured with a Marker. This class provides an interface
- * that follows the {@link java.io.OutputStream} methods in spirit, but doesn't require output to any external stream.
- * This class should <em>not</em> be used as a stream for an underlying logger unless it's being used as a bridge.
- * Otherwise, infinite loops may occur!
- */
-public class LoggerOutputStream extends OutputStream {
-    private static final String FQCN = LoggerOutputStream.class.getName();
-
-    private final ByteStreamLogger logger;
-    private final String fqcn;
-
-    public LoggerOutputStream(final ExtendedLogger logger, final Level level) {
-        this(logger, level, null, Charset.defaultCharset(), FQCN);
-    }
-
-    public LoggerOutputStream(final ExtendedLogger logger, final Level level, final Charset charset) {
-        this(logger, level, null, charset, FQCN);
-    }
-
-    public LoggerOutputStream(final ExtendedLogger logger, final Level level, final Marker marker) {
-        this(logger, level, marker, Charset.defaultCharset(), FQCN);
-    }
-
-    public LoggerOutputStream(final ExtendedLogger logger, final Level level, final Marker marker, final Charset charset) {
-        this(logger, level, marker, charset, FQCN);
-    }
-
-    public LoggerOutputStream(final ExtendedLogger logger, final Level level, final Marker marker,
-            final Charset charset, final String fqcn) {
-        this.logger = new ByteStreamLogger(logger, level, marker, charset);
-        this.fqcn = fqcn;
-    }
-
-    @Override
-    public void close() throws IOException {
-        this.logger.close(this.fqcn);
-    }
-
-    @Override
-    public void flush() throws IOException {
-        // do nothing
-    }
-
-    @Override
-    public void write(final byte[] b) throws IOException {
-        this.logger.put(this.fqcn, b, 0, b.length);
-    }
-
-    @Override
-    public void write(final byte[] b, final int off, final int len) throws IOException {
-        this.logger.put(this.fqcn, b, off, len);
-    }
-
-    @Override
-    public void write(final int b) throws IOException {
-        this.logger.put(this.fqcn, (byte) (b & 0xFF));
-    }
-}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ffc1a38a/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerPrintStream.java
----------------------------------------------------------------------
diff --git a/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerPrintStream.java b/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerPrintStream.java
deleted file mode 100644
index 2deefdb..0000000
--- a/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerPrintStream.java
+++ /dev/null
@@ -1,284 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.logging.log4j.streams;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.PrintStream;
-import java.io.UnsupportedEncodingException;
-import java.nio.charset.Charset;
-import java.util.Locale;
-
-import org.apache.logging.log4j.Level;
-import org.apache.logging.log4j.Marker;
-import org.apache.logging.log4j.spi.ExtendedLogger;
-
-/**
- * Logs each line written to a pre-defined level. Can also be configured with a Marker. This class provides an interface
- * that follows the {@link java.io.PrintStream} methods in spirit, but doesn't require output to any external stream.
- * This class should <em>not</em> be used as a stream for an underlying logger unless it's being used as a bridge.
- * Otherwise, infinite loops may occur!
- */
-public class LoggerPrintStream extends PrintStream {
-    private static final String FQCN = LoggerPrintStream.class.getName();
-
-    public LoggerPrintStream(final ExtendedLogger logger, final boolean autoFlush, final Charset charset,
-            final String fqcn, final Level level, final Marker marker) throws UnsupportedEncodingException {
-        super(new LoggerOutputStream(logger, level, marker, charset, fqcn), autoFlush, charset.name());
-    }
-
-    public LoggerPrintStream(final ExtendedLogger logger, final Level level) throws UnsupportedEncodingException {
-        this(logger, false, Charset.defaultCharset(), FQCN, level, null);
-    }
-
-    public LoggerPrintStream(final ExtendedLogger logger, final Level level, final Charset charset)
-            throws UnsupportedEncodingException {
-        this(logger, false, charset, FQCN, level, null);
-    }
-
-    public LoggerPrintStream(final ExtendedLogger logger, final Level level, final Marker marker)
-            throws UnsupportedEncodingException {
-        this(logger, false, Charset.defaultCharset(), FQCN, level, marker);
-    }
-
-    public LoggerPrintStream(final ExtendedLogger logger, final Level level, final Marker marker, final Charset charset)
-            throws UnsupportedEncodingException {
-        this(logger, false, charset, FQCN, level, marker);
-    }
-
-    public LoggerPrintStream(final OutputStream out, final boolean autoFlush, final Charset charset,
-            final ExtendedLogger logger, final Level level) throws UnsupportedEncodingException {
-        this(out, autoFlush, charset, logger, FQCN, level, null);
-    }
-
-    public LoggerPrintStream(final OutputStream out, final boolean autoFlush, final Charset charset,
-            final ExtendedLogger logger, final Level level, final Marker marker) throws UnsupportedEncodingException {
-        this(out, autoFlush, charset, logger, FQCN, level, marker);
-    }
-
-    public LoggerPrintStream(final OutputStream out, final boolean autoFlush, final Charset charset,
-            final ExtendedLogger logger, final String fqcn, final Level level, final Marker marker)
-            throws UnsupportedEncodingException {
-        super(new LoggerFilterOutputStream(out, charset, logger, fqcn, level, marker), autoFlush, charset.name());
-    }
-
-    public LoggerPrintStream(final OutputStream out, final boolean autoFlush, final ExtendedLogger logger,
-            final Level level) {
-        this(out, autoFlush, logger, FQCN, level, null);
-    }
-
-    public LoggerPrintStream(final OutputStream out, final boolean autoFlush, final ExtendedLogger logger,
-            final Level level, final Marker marker) {
-        this(out, autoFlush, logger, FQCN, level, marker);
-    }
-
-    public LoggerPrintStream(final OutputStream out, final boolean autoFlush, final ExtendedLogger logger,
-            final String fqcn, final Level level, final Marker marker) {
-        super(new LoggerFilterOutputStream(out, Charset.defaultCharset(), logger, fqcn, level, marker), autoFlush);
-    }
-
-    public LoggerPrintStream(final OutputStream out, final Charset charset, final ExtendedLogger logger,
-            final Level level) throws UnsupportedEncodingException {
-        this(out, false, charset, logger, FQCN, level, null);
-    }
-
-    public LoggerPrintStream(final OutputStream out, final Charset charset, final ExtendedLogger logger,
-            final Level level, final Marker marker) throws UnsupportedEncodingException {
-        this(out, false, charset, logger, FQCN, level, marker);
-    }
-
-    public LoggerPrintStream(final OutputStream out, final ExtendedLogger logger, final Level level) {
-        this(out, false, logger, FQCN, level, null);
-    }
-
-    public LoggerPrintStream(final OutputStream out, final ExtendedLogger logger, final Level level, final Marker marker) {
-        this(out, false, logger, FQCN, level, marker);
-    }
-
-    @Override
-    public LoggerPrintStream append(final char c) {
-        super.append(c);
-        return this;
-    }
-
-    @Override
-    public LoggerPrintStream append(final CharSequence csq) {
-        super.append(csq);
-        return this;
-    }
-
-    @Override
-    public LoggerPrintStream append(final CharSequence csq, final int start, final int end) {
-        super.append(csq, start, end);
-        return this;
-    }
-
-    @Override
-    public boolean checkError() {
-        return super.checkError();
-    }
-
-    @Override
-    public void close() {
-        super.close();
-    }
-
-    @Override
-    public void flush() {
-        super.flush();
-    }
-
-    @Override
-    public LoggerPrintStream format(final Locale l, final String format, final Object... args) {
-        super.format(l, format, args);
-        return this;
-    }
-
-    @Override
-    public LoggerPrintStream format(final String format, final Object... args) {
-        super.format(format, args);
-        return this;
-    }
-
-    @Override
-    public void print(final boolean b) {
-        super.print(b);
-    }
-
-    @Override
-    public void print(final char c) {
-        super.print(c);
-    }
-
-    @Override
-    public void print(final char[] s) {
-        super.print(s);
-    }
-
-    @Override
-    public void print(final double d) {
-        super.print(d);
-    }
-
-    @Override
-    public void print(final float f) {
-        super.print(f);
-    }
-
-    @Override
-    public void print(final int i) {
-        super.print(i);
-    }
-
-    @Override
-    public void print(final long l) {
-        super.print(l);
-    }
-
-    @Override
-    public void print(final Object obj) {
-        super.print(obj);
-    }
-
-    @Override
-    public void print(final String s) {
-        super.print(s);
-    }
-
-    @Override
-    public LoggerPrintStream printf(final Locale l, final String format, final Object... args) {
-        super.printf(l, format, args);
-        return this;
-    }
-
-    @Override
-    public LoggerPrintStream printf(final String format, final Object... args) {
-        super.printf(format, args);
-        return this;
-    }
-
-    @Override
-    public void println() {
-        super.println();
-    }
-
-    @Override
-    public void println(final boolean x) {
-        super.println(x);
-    }
-
-    @Override
-    public void println(final char x) {
-        super.println(x);
-    }
-
-    @Override
-    public void println(final char[] x) {
-        super.println(x);
-    }
-
-    @Override
-    public void println(final double x) {
-        super.println(x);
-    }
-
-    @Override
-    public void println(final float x) {
-        super.println(x);
-    }
-
-    @Override
-    public void println(final int x) {
-        super.println(x);
-    }
-
-    @Override
-    public void println(final long x) {
-        super.println(x);
-    }
-
-    @Override
-    public void println(final Object x) {
-        super.println(x);
-    }
-
-    @Override
-    public void println(final String x) {
-        super.println(x);
-    }
-
-    @Override
-    public String toString() {
-        return LoggerPrintStream.class.getSimpleName() + "{stream=" + this.out + '}';
-    }
-
-    @Override
-    public void write(final byte[] b) throws IOException {
-        super.write(b);
-    }
-
-    @Override
-    public void write(final byte[] b, final int off, final int len) {
-        super.write(b, off, len);
-    }
-
-    @Override
-    public void write(final int b) {
-        super.write(b);
-    }
-}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ffc1a38a/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerPrintWriter.java
----------------------------------------------------------------------
diff --git a/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerPrintWriter.java b/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerPrintWriter.java
deleted file mode 100644
index e5cdf98..0000000
--- a/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerPrintWriter.java
+++ /dev/null
@@ -1,258 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.logging.log4j.streams;
-
-import java.io.PrintWriter;
-import java.io.Writer;
-import java.util.Locale;
-
-import org.apache.logging.log4j.Level;
-import org.apache.logging.log4j.Marker;
-import org.apache.logging.log4j.spi.ExtendedLogger;
-
-/**
- * Logs each line written to a pre-defined level. Can also be configured with a Marker. This class provides an interface
- * that follows the {@link java.io.PrintWriter} methods in spirit, but doesn't require output to any external writer.
- * <p>
- * Integration with JDBC logging can be as simple as:
- * </p>
- * <pre>DriverManager.setLogWriter(new LoggerPrintWriter((ExtendedLogger) LogManager.getLogger(), Level.DEBUG));
- * </pre>
- */
-public class LoggerPrintWriter extends PrintWriter {
-    private static final String FQCN = LoggerPrintWriter.class.getName();
-
-    @SuppressWarnings("resource")
-    public LoggerPrintWriter(final ExtendedLogger logger, final boolean autoFlush, final String fqcn,
-            final Level level, final Marker marker) {
-        super(new LoggerWriter(logger, fqcn, level, marker), autoFlush);
-    }
-
-    public LoggerPrintWriter(final ExtendedLogger logger, final Level level) {
-        this(logger, false, FQCN, level, null);
-    }
-
-    public LoggerPrintWriter(final ExtendedLogger logger, final Level level, final Marker marker) {
-        this(logger, false, FQCN, level, marker);
-    }
-
-    public LoggerPrintWriter(final Writer writer, final boolean autoFlush, final ExtendedLogger logger, final Level level) {
-        this(writer, autoFlush, logger, FQCN, level, null);
-    }
-
-    public LoggerPrintWriter(final Writer writer, final boolean autoFlush, final ExtendedLogger logger, final Level level,
-            final Marker marker) {
-        this(writer, autoFlush, logger, FQCN, level, marker);
-    }
-
-    @SuppressWarnings("resource")
-    public LoggerPrintWriter(final Writer writer, final boolean autoFlush, final ExtendedLogger logger,
-            final String fqcn, final Level level, final Marker marker) {
-        super(new LoggerFilterWriter(writer, logger, fqcn, level, marker), autoFlush);
-    }
-
-    public LoggerPrintWriter(final Writer writer, final ExtendedLogger logger, final Level level) {
-        this(writer, false, logger, FQCN, level, null);
-    }
-
-    public LoggerPrintWriter(final Writer writer, final ExtendedLogger logger, final Level level, final Marker marker) {
-        this(writer, false, logger, FQCN, level, marker);
-    }
-
-    @Override
-    public LoggerPrintWriter append(final char c) {
-        super.append(c);
-        return this;
-    }
-
-    @Override
-    public LoggerPrintWriter append(final CharSequence csq) {
-        super.append(csq);
-        return this;
-    }
-
-    @Override
-    public LoggerPrintWriter append(final CharSequence csq, final int start, final int end) {
-        super.append(csq, start, end);
-        return this;
-    }
-
-    @Override
-    public boolean checkError() {
-        return super.checkError();
-    }
-
-    @Override
-    public void close() {
-        super.close();
-    }
-
-    @Override
-    public void flush() {
-        super.flush();
-    }
-
-    @Override
-    public LoggerPrintWriter format(final Locale l, final String format, final Object... args) {
-        super.format(l, format, args);
-        return this;
-    }
-
-    @Override
-    public LoggerPrintWriter format(final String format, final Object... args) {
-        super.format(format, args);
-        return this;
-    }
-
-    @Override
-    public void print(final boolean b) {
-        super.print(b);
-    }
-
-    @Override
-    public void print(final char c) {
-        super.print(c);
-    }
-
-    @Override
-    public void print(final char[] s) {
-        super.print(s);
-    }
-
-    @Override
-    public void print(final double d) {
-        super.print(d);
-    }
-
-    @Override
-    public void print(final float f) {
-        super.print(f);
-    }
-
-    @Override
-    public void print(final int i) {
-        super.print(i);
-    }
-
-    @Override
-    public void print(final long l) {
-        super.print(l);
-    }
-
-    @Override
-    public void print(final Object obj) {
-        super.print(obj);
-    }
-
-    @Override
-    public void print(final String s) {
-        super.print(s);
-    }
-
-    @Override
-    public LoggerPrintWriter printf(final Locale l, final String format, final Object... args) {
-        super.printf(l, format, args);
-        return this;
-    }
-
-    @Override
-    public LoggerPrintWriter printf(final String format, final Object... args) {
-        super.printf(format, args);
-        return this;
-    }
-
-    @Override
-    public void println() {
-        super.println();
-    }
-
-    @Override
-    public void println(final boolean x) {
-        super.println(x);
-    }
-
-    @Override
-    public void println(final char x) {
-        super.println(x);
-    }
-
-    @Override
-    public void println(final char[] x) {
-        super.println(x);
-    }
-
-    @Override
-    public void println(final double x) {
-        super.println(x);
-    }
-
-    @Override
-    public void println(final float x) {
-        super.println(x);
-    }
-
-    @Override
-    public void println(final int x) {
-        super.println(x);
-    }
-
-    @Override
-    public void println(final long x) {
-        super.println(x);
-    }
-
-    @Override
-    public void println(final Object x) {
-        super.println(x);
-    }
-
-    @Override
-    public void println(final String x) {
-        super.println(x);
-    }
-
-    @Override
-    public String toString() {
-        return LoggerPrintWriter.class.getSimpleName() + "{stream=" + this.out + '}';
-    }
-
-    @Override
-    public void write(final char[] buf) {
-        super.write(buf);
-    }
-
-    @Override
-    public void write(final char[] buf, final int off, final int len) {
-        super.write(buf, off, len);
-    }
-
-    @Override
-    public void write(final int c) {
-        super.write(c);
-    }
-
-    @Override
-    public void write(final String s) {
-        super.write(s);
-    }
-
-    @Override
-    public void write(final String s, final int off, final int len) {
-        super.write(s, off, len);
-    }
-}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ffc1a38a/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerReader.java
----------------------------------------------------------------------
diff --git a/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerReader.java b/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerReader.java
deleted file mode 100644
index 5e7ccd8..0000000
--- a/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerReader.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.logging.log4j.streams;
-
-import java.io.FilterReader;
-import java.io.IOException;
-import java.io.Reader;
-import java.nio.CharBuffer;
-
-import org.apache.logging.log4j.Level;
-import org.apache.logging.log4j.Marker;
-import org.apache.logging.log4j.spi.ExtendedLogger;
-import org.apache.logging.log4j.streams.util.CharStreamLogger;
-
-/**
- * Logs each line written to a pre-defined level. Can also be configured with a Marker. This class provides an interface
- * that follows the {@link java.io.Writer} methods in spirit, but doesn't require output to any external writer.
- */
-public class LoggerReader extends FilterReader {
-    private static final String FQCN = LoggerReader.class.getName();
-
-    private final CharStreamLogger logger;
-    private final String fqcn;
-
-    public LoggerReader(final Reader reader, final ExtendedLogger logger, final Level level) {
-        this(reader, logger, FQCN, level, null);
-    }
-
-    public LoggerReader(final Reader reader, final ExtendedLogger logger, final Level level, final Marker marker) {
-        this(reader, logger, FQCN, level, marker);
-    }
-
-    public LoggerReader(final Reader reader, final ExtendedLogger logger, final String fqcn, final Level level,
-            final Marker marker) {
-        super(reader);
-        this.logger = new CharStreamLogger(logger, level, marker);
-        this.fqcn = fqcn;
-    }
-
-    @Override
-    public void close() throws IOException {
-        super.close();
-        this.logger.close(this.fqcn);
-    }
-
-    @Override
-    public int read() throws IOException {
-        final int c = super.read();
-        this.logger.put(this.fqcn, c);
-        return c;
-    }
-
-    @Override
-    public int read(final char[] cbuf) throws IOException {
-        return read(cbuf, 0, cbuf.length);
-    }
-
-    @Override
-    public int read(final char[] cbuf, final int off, final int len) throws IOException {
-        final int charsRead = super.read(cbuf, off, len);
-        this.logger.put(this.fqcn, cbuf, off, charsRead);
-        return charsRead;
-    }
-
-    @Override
-    public int read(final CharBuffer target) throws IOException {
-        final int len = target.remaining();
-        final char[] cbuf = new char[len];
-        final int charsRead = read(cbuf, 0, len);
-        if (charsRead > 0) {
-            target.put(cbuf, 0, charsRead);
-        }
-        return charsRead;
-    }
-
-    @Override
-    public String toString() {
-        return LoggerReader.class.getSimpleName() + "{stream=" + this.in + '}';
-    }
-}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ffc1a38a/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerStreams.java
----------------------------------------------------------------------
diff --git a/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerStreams.java b/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerStreams.java
deleted file mode 100644
index bef87b5..0000000
--- a/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerStreams.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.logging.log4j.streams;
-
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.Reader;
-import java.io.UnsupportedEncodingException;
-import java.io.Writer;
-import java.nio.charset.Charset;
-
-import org.apache.logging.log4j.Level;
-import org.apache.logging.log4j.Marker;
-import org.apache.logging.log4j.spi.ExtendedLogger;
-
-public class LoggerStreams {
-
-    public static class BufferedBuilder {
-        private final ExtendedLogger logger;
-        private final Level level;
-        private final Marker marker;
-        private final int size;
-
-        BufferedBuilder(final ExtendedLogger logger, final Level level, final Marker marker, final int size) {
-            this.logger = logger;
-            this.level = level;
-            this.marker = marker;
-            this.size = size;
-        }
-
-        public LoggerBufferedInputStream create(final InputStream in) {
-            if (this.size > 0) {
-                return new LoggerBufferedInputStream(in, this.size, this.logger, this.level, this.marker);
-            }
-            return new LoggerBufferedInputStream(in, this.logger, this.level, this.marker);
-        }
-
-        public LoggerBufferedInputStream create(final InputStream in, final Charset charset) {
-            if (this.size > 0) {
-                return new LoggerBufferedInputStream(in, charset, this.size, this.logger, this.level, this.marker);
-            }
-            return new LoggerBufferedInputStream(in, charset, this.logger, this.level, this.marker);
-        }
-
-        public LoggerBufferedReader create(final Reader reader) {
-            if (this.size > 0) {
-                return new LoggerBufferedReader(reader, this.size, this.logger, this.level, this.marker);
-            }
-            return new LoggerBufferedReader(reader, this.logger, this.level, this.marker);
-        }
-
-        public BufferedBuilder marker(final Marker marker) {
-            return new BufferedBuilder(this.logger, this.level, marker, this.size);
-        }
-
-        public BufferedBuilder size(final int size) {
-            return new BufferedBuilder(this.logger, this.level, this.marker, size);
-        }
-    }
-
-    public static class Builder {
-        private final ExtendedLogger logger;
-        private final Level level;
-        private final Marker marker;
-
-        Builder(final ExtendedLogger logger, final Level level, final Marker marker) {
-            this.logger = logger;
-            this.level = level;
-            this.marker = marker;
-        }
-
-        public BufferedBuilder buffered() {
-            return new BufferedBuilder(this.logger, this.level, this.marker, 0);
-        }
-
-        public LoggerFilterWriter create(final Writer writer) {
-            return new LoggerFilterWriter(writer, this.logger, this.level, this.marker);
-        }
-
-        public Builder marker(final Marker marker) {
-            return new Builder(this.logger, this.level, marker);
-        }
-
-        public PrintingBuilder printing() {
-            return new PrintingBuilder(this.logger, this.level, this.marker, false);
-        }
-    }
-
-    public static class PrintingBuilder {
-        private final ExtendedLogger logger;
-        private final Level level;
-        private final Marker marker;
-        private final boolean autoFlush;
-
-        PrintingBuilder(final ExtendedLogger logger, final Level level, final Marker marker, final boolean autoFlush) {
-            this.logger = logger;
-            this.level = level;
-            this.marker = marker;
-            this.autoFlush = autoFlush;
-        }
-
-        public PrintingBuilder autoFlush() {
-            return autoFlush(true);
-        }
-
-        public PrintingBuilder autoFlush(final boolean autoFlush) {
-            return new PrintingBuilder(this.logger, this.level, this.marker, autoFlush);
-        }
-
-        public LoggerPrintStream create(final OutputStream out) {
-            return new LoggerPrintStream(out, this.autoFlush, this.logger, this.level, this.marker);
-        }
-
-        public LoggerPrintStream create(final OutputStream out, final Charset charset) {
-            try {
-                return new LoggerPrintStream(out, this.autoFlush, charset, this.logger, this.level, this.marker);
-            } catch (final UnsupportedEncodingException e) {
-                // Should never occur because the constructor must throw this
-                throw new IllegalArgumentException("Invalid charset", e);
-            }
-        }
-
-        public LoggerPrintWriter create(final Writer writer) {
-            return new LoggerPrintWriter(writer, this.autoFlush, this.logger, this.level, this.marker);
-        }
-
-        public PrintingBuilder marker(final Marker marker) {
-            return new PrintingBuilder(this.logger, this.level, marker, this.autoFlush);
-        }
-    }
-
-    public static Builder debug(final ExtendedLogger logger) {
-        return new Builder(logger, Level.DEBUG, null);
-    }
-
-    public static Builder error(final ExtendedLogger logger) {
-        return new Builder(logger, Level.ERROR, null);
-    }
-
-    public static Builder fatal(final ExtendedLogger logger) {
-        return new Builder(logger, Level.FATAL, null);
-    }
-
-    public static Builder info(final ExtendedLogger logger) {
-        return new Builder(logger, Level.INFO, null);
-    }
-
-    public static Builder trace(final ExtendedLogger logger) {
-        return new Builder(logger, Level.TRACE, null);
-    }
-
-    public static Builder warn(final ExtendedLogger logger) {
-        return new Builder(logger, Level.WARN, null);
-    }
-}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ffc1a38a/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerWriter.java
----------------------------------------------------------------------
diff --git a/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerWriter.java b/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerWriter.java
deleted file mode 100644
index 68fdc83..0000000
--- a/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerWriter.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.logging.log4j.streams;
-
-import java.io.IOException;
-import java.io.Writer;
-
-import org.apache.logging.log4j.Level;
-import org.apache.logging.log4j.Marker;
-import org.apache.logging.log4j.spi.ExtendedLogger;
-import org.apache.logging.log4j.streams.util.CharStreamLogger;
-
-/**
- * Logs each line written to a pre-defined level. Can also be configured with a Marker. This class provides an interface
- * that follows the {@link java.io.Writer} methods in spirit, but doesn't require output to any external writer.
- */
-public class LoggerWriter extends Writer {
-    private static final String FQCN = LoggerWriter.class.getName();
-
-    private final CharStreamLogger logger;
-    private final String fqcn;
-
-    public LoggerWriter(final ExtendedLogger logger, final Level level) {
-        this(logger, FQCN, level, null);
-    }
-
-    public LoggerWriter(final ExtendedLogger logger, final Level level, final Marker marker) {
-        this(logger, FQCN, level, marker);
-    }
-
-    public LoggerWriter(final ExtendedLogger logger, final String fqcn, final Level level, final Marker marker) {
-        this.logger = new CharStreamLogger(logger, level, marker);
-        this.fqcn = fqcn;
-    }
-
-    @Override
-    public void close() throws IOException {
-        this.logger.close(this.fqcn);
-    }
-
-    @Override
-    public void flush() throws IOException {
-        // do nothing
-    }
-
-    @Override
-    public String toString() {
-        return this.getClass().getSimpleName() + "[fqcn=" + this.fqcn + ", logger=" + this.logger + "]";
-    }
-
-    @Override
-    public void write(final char[] cbuf) throws IOException {
-        this.logger.put(this.fqcn, cbuf, 0, cbuf.length);
-    }
-
-    @Override
-    public void write(final char[] cbuf, final int off, final int len) throws IOException {
-        this.logger.put(this.fqcn, cbuf, off, len);
-    }
-
-    @Override
-    public void write(final int c) throws IOException {
-        this.logger.put(this.fqcn, (char) c);
-    }
-
-    @Override
-    public void write(final String str) throws IOException {
-        this.logger.put(this.fqcn, str, 0, str.length());
-    }
-
-    @Override
-    public void write(final String str, final int off, final int len) throws IOException {
-        this.logger.put(this.fqcn, str, off, len);
-    }
-}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ffc1a38a/log4j-streams/src/main/java/org/apache/logging/log4j/streams/util/ByteStreamLogger.java
----------------------------------------------------------------------
diff --git a/log4j-streams/src/main/java/org/apache/logging/log4j/streams/util/ByteStreamLogger.java b/log4j-streams/src/main/java/org/apache/logging/log4j/streams/util/ByteStreamLogger.java
deleted file mode 100644
index 106934c..0000000
--- a/log4j-streams/src/main/java/org/apache/logging/log4j/streams/util/ByteStreamLogger.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.logging.log4j.streams.util;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.nio.ByteBuffer;
-import java.nio.charset.Charset;
-
-import org.apache.logging.log4j.Level;
-import org.apache.logging.log4j.Marker;
-import org.apache.logging.log4j.spi.ExtendedLogger;
-
-public class ByteStreamLogger {
-    private class ByteBufferInputStream extends InputStream {
-
-        @Override
-        public int read() throws IOException {
-            ByteStreamLogger.this.buf.flip();
-            int result = -1;
-            if (ByteStreamLogger.this.buf.limit() > 0) {
-                result = ByteStreamLogger.this.buf.get() & 0xFF;
-            }
-            ByteStreamLogger.this.buf.compact();
-            return result;
-        }
-
-        @Override
-        public int read(final byte[] bytes, final int off, final int len) throws IOException {
-            ByteStreamLogger.this.buf.flip();
-            int result = -1;
-            if (ByteStreamLogger.this.buf.limit() > 0) {
-                result = Math.min(len, ByteStreamLogger.this.buf.limit());
-                ByteStreamLogger.this.buf.get(bytes, off, result);
-            }
-            ByteStreamLogger.this.buf.compact();
-            return result;
-        }
-    }
-
-    private static final int BUFFER_SIZE = 1024;
-    private final ExtendedLogger logger;
-    private final Level level;
-    private final Marker marker;
-    private final ByteBufferInputStream inputStream;
-    private final InputStreamReader reader;
-    private final char[] msgBuf = new char[BUFFER_SIZE];
-    private final StringBuilder msg = new StringBuilder();
-    private boolean closed;
-
-    private final ByteBuffer buf = ByteBuffer.allocate(BUFFER_SIZE);
-
-    public ByteStreamLogger(final ExtendedLogger logger, final Level level, final Marker marker, final Charset charset) {
-        this.logger = logger;
-        this.level = level;
-        this.marker = marker;
-        this.inputStream = new ByteBufferInputStream();
-        this.reader = new InputStreamReader(this.inputStream, charset);
-    }
-
-    public void close(final String fqcn) {
-        synchronized (this.msg) {
-            this.closed = true;
-            logEnd(fqcn);
-//            in.close();
-        }
-    }
-
-    private void extractMessages(final String fqcn) throws IOException {
-        if (this.closed) {
-            return;
-        }
-        int read = this.reader.read(this.msgBuf);
-        while (read > 0) {
-            int off = 0;
-            for (int pos = 0; pos < read; pos++) {
-                switch (this.msgBuf[pos]) {
-                case '\r':
-                    this.msg.append(this.msgBuf, off, pos - off);
-                    off = pos + 1;
-                    break;
-                case '\n':
-                    this.msg.append(this.msgBuf, off, pos - off);
-                    off = pos + 1;
-                    log(fqcn);
-                    break;
-                }
-            }
-            this.msg.append(this.msgBuf, off, read - off);
-            read = this.reader.read(this.msgBuf);
-        }
-    }
-
-    private void log(final String fqcn) {
-        // convert to string now so async loggers work
-        this.logger.logIfEnabled(fqcn, this.level, this.marker, this.msg.toString());
-        this.msg.setLength(0);
-    }
-    
-    private void logEnd(final String fqcn) {
-        if (this.msg.length() > 0) {
-            log(fqcn);
-        }
-    }
-
-    public void put(final String fqcn, final byte[] b, final int off, final int len) throws IOException {
-        int curOff = off;
-        int curLen = len;
-        if (curLen >= 0) {
-            synchronized (this.msg) {
-                while (curLen > this.buf.remaining()) {
-                    final int remaining = this.buf.remaining();
-                    this.buf.put(b, curOff, remaining);
-                    curLen -= remaining;
-                    curOff += remaining;
-                    extractMessages(fqcn);
-                }
-                this.buf.put(b, curOff, curLen);
-                extractMessages(fqcn);
-            }
-        } else {
-            logEnd(fqcn);
-        }
-    }
-
-    public void put(final String fqcn, final int b) throws IOException {
-        if (b >= 0) {
-            synchronized (this.msg) {
-                this.buf.put((byte) (b & 0xFF));
-                extractMessages(fqcn);
-            }
-        } else {
-            logEnd(fqcn);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ffc1a38a/log4j-streams/src/main/java/org/apache/logging/log4j/streams/util/CharStreamLogger.java
----------------------------------------------------------------------
diff --git a/log4j-streams/src/main/java/org/apache/logging/log4j/streams/util/CharStreamLogger.java b/log4j-streams/src/main/java/org/apache/logging/log4j/streams/util/CharStreamLogger.java
deleted file mode 100644
index ffe2c17..0000000
--- a/log4j-streams/src/main/java/org/apache/logging/log4j/streams/util/CharStreamLogger.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.logging.log4j.streams.util;
-
-import java.nio.CharBuffer;
-
-import org.apache.logging.log4j.Level;
-import org.apache.logging.log4j.Marker;
-import org.apache.logging.log4j.spi.ExtendedLogger;
-
-public class CharStreamLogger {
-    private final ExtendedLogger logger;
-    private final Level level;
-    private final Marker marker;
-    private final StringBuilder msg = new StringBuilder();
-    private boolean closed = false;
-
-    public CharStreamLogger(final ExtendedLogger logger, final Level level, final Marker marker) {
-        this.logger = logger;
-        this.level = level;
-        this.marker = marker;
-    }
-
-    public void close(final String fqcn) {
-        synchronized (this.msg) {
-            this.closed = true;
-            logEnd(fqcn);
-        }
-    }
-
-    private void log(final String fqcn) {
-        // convert to string now so async loggers work
-        this.logger.logIfEnabled(fqcn, this.level, this.marker, this.msg.toString());
-        this.msg.setLength(0);
-    }
-
-    private void logEnd(final String fqcn) {
-        if (this.msg.length() > 0) {
-            log(fqcn);
-        }
-    }
-
-    public void put(final String fqcn, final char[] cbuf, final int off, final int len) {
-        put(fqcn, CharBuffer.wrap(cbuf), off, len);
-    }
-
-    public void put(final String fqcn, final CharSequence str, final int off, final int len) {
-        if (len >= 0) {
-            synchronized (this.msg) {
-                if (this.closed) {
-                    return;
-                }
-                int start = off;
-                final int end = off + len;
-                for (int pos = off; pos < end; pos++) {
-                    final char c = str.charAt(pos);
-                    switch (c) {
-                    case '\r':
-                    case '\n':
-                        this.msg.append(str, start, pos);
-                        start = pos + 1;
-                        if (c == '\n') {
-                            log(fqcn);
-                        }
-                        break;
-                    }
-                }
-                this.msg.append(str, start, end);
-            }
-        } else {
-            logEnd(fqcn);
-        }
-    }
-
-    public void put(final String fqcn, final int c) {
-        if (c >= 0) {
-            synchronized (this.msg) {
-                if (this.closed) {
-                    return;
-                }
-                switch (c) {
-                case '\n':
-                    log(fqcn);
-                    break;
-                case '\r':
-                    break;
-                default:
-                    this.msg.append((char) c);
-                }
-            }
-        } else {
-            logEnd(fqcn);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ffc1a38a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/AbstractLoggerOutputStreamTest.java
----------------------------------------------------------------------
diff --git a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/AbstractLoggerOutputStreamTest.java b/log4j-streams/src/test/java/org/apache/logging/log4j/streams/AbstractLoggerOutputStreamTest.java
deleted file mode 100644
index 9108794..0000000
--- a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/AbstractLoggerOutputStreamTest.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.logging.log4j.streams;
-
-import static org.easymock.EasyMock.replay;
-import static org.easymock.EasyMock.verify;
-import static org.junit.Assert.assertEquals;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-
-import org.easymock.EasyMock;
-import org.junit.Before;
-import org.junit.Test;
-
-public abstract class AbstractLoggerOutputStreamTest extends AbstractStreamTest {
-    protected OutputStream out;
-    protected ByteArrayOutputStream wrapped;
-
-    protected abstract ByteArrayOutputStream createOutputStream();
-
-    protected abstract OutputStream createOutputStreamWrapper();
-
-    @Before
-    public void createStream() {
-        this.wrapped = createOutputStream();
-        this.out = createOutputStreamWrapper();
-    }
-
-    @Test
-    public void testClose_HasRemainingData() throws IOException {
-        this.out.write(FIRST.getBytes());
-        assertMessages();
-        this.out.close();
-        assertMessages(FIRST);
-        if (this.wrapped != null) {
-            assertEquals(FIRST, this.wrapped.toString());
-        }
-    }
-
-    @Test
-    public void testClose_NoRemainingData() throws IOException {
-        this.out.close();
-        assertMessages();
-        if (this.wrapped != null) {
-            assertEquals("", this.wrapped.toString());
-        }
-    }
-
-    @Test
-    public void testFlush() throws IOException {
-        final OutputStream out = EasyMock.createMock("out", OutputStream.class);
-        out.flush(); // expect the flush to come through to the mocked OutputStream
-        out.close();
-        replay(out);
-
-        final LoggerFilterOutputStream los = new LoggerFilterOutputStream(out, getExtendedLogger(), LEVEL);
-        los.flush();
-        los.close();
-        verify(out);
-    }
-
-    @Test
-    public void testWrite_ByteArray() throws Exception {
-        final byte[] bytes = "byte[]".getBytes();
-        this.out.write(bytes);
-        assertMessages();
-        this.out.write('\n');
-        assertMessages("byte[]");
-        if (this.wrapped != null) {
-            assertEquals("byte[]\n", this.wrapped.toString());
-        }
-    }
-
-    @Test
-    public void testWrite_ByteArray_Offset_Length() throws Exception {
-        final byte[] bytes = "byte[]".getBytes();
-        final int middle = bytes.length / 2;
-        final int length = bytes.length - middle;
-        final String right = new String(bytes, middle, length);
-        this.out.write(bytes, middle, length);
-        assertMessages();
-        this.out.write('\n');
-        assertMessages(right);
-        if (this.wrapped != null) {
-            assertEquals("byte[]".substring(middle, bytes.length) + '\n', this.wrapped.toString());
-        }
-    }
-
-    @Test
-    public void testWrite_IgnoresWindowsNewline() throws IOException {
-        this.out.write(FIRST.getBytes());
-        this.out.write("\r\n".getBytes());
-        this.out.write(LAST.getBytes());
-        this.out.close();
-        assertMessages(FIRST, LAST);
-        if (this.wrapped != null) {
-            assertEquals(FIRST + "\r\n" + LAST, this.wrapped.toString());
-        }
-    }
-
-    @Test
-    public void testWrite_Int() throws Exception {
-        for (final byte b : "int".getBytes()) {
-            this.out.write(b);
-            assertMessages();
-        }
-        this.out.write('\n');
-        assertMessages("int");
-        if (this.wrapped != null) {
-            assertEquals("int" + '\n', this.wrapped.toString());
-        }
-    }
-
-    @Test
-    public void testWrite_MultipleLines() throws IOException {
-        this.out.write((FIRST + '\n' + LAST + '\n').getBytes());
-        assertMessages(FIRST, LAST);
-        if (this.wrapped != null) {
-            assertEquals(FIRST + '\n' + LAST + '\n', this.wrapped.toString());
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ffc1a38a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/AbstractLoggerWriterTest.java
----------------------------------------------------------------------
diff --git a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/AbstractLoggerWriterTest.java b/log4j-streams/src/test/java/org/apache/logging/log4j/streams/AbstractLoggerWriterTest.java
deleted file mode 100644
index 7b19495..0000000
--- a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/AbstractLoggerWriterTest.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.logging.log4j.streams;
-
-import static org.easymock.EasyMock.replay;
-import static org.easymock.EasyMock.verify;
-import static org.junit.Assert.assertEquals;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.StringWriter;
-import java.io.Writer;
-
-import org.easymock.EasyMock;
-import org.junit.Before;
-import org.junit.Test;
-
-public abstract class AbstractLoggerWriterTest extends AbstractStreamTest {
-    protected StringWriter wrapped;
-    protected Writer writer;
-
-    @Before
-    public void createStream() {
-        this.wrapped = createWriter();
-        this.writer = createWriterWrapper();
-    }
-
-    protected abstract StringWriter createWriter();
-
-    protected abstract Writer createWriterWrapper();
-
-    @Test
-    public void testClose_HasRemainingData() throws IOException {
-        this.writer.write(FIRST);
-        assertMessages();
-        this.writer.close();
-        assertMessages(FIRST);
-        if (this.wrapped != null) {
-            assertEquals(FIRST, this.wrapped.toString());
-        }
-    }
-
-    @Test
-    public void testClose_NoRemainingData() throws IOException {
-        this.writer.close();
-        assertMessages();
-        if (this.wrapped != null) {
-            assertEquals("", this.wrapped.toString());
-        }
-    }
-
-    @Test
-    public void testFlush() throws IOException {
-        final OutputStream out = EasyMock.createMock(OutputStream.class);
-        out.flush(); // expect the flush to come through to the mocked OutputStream
-        out.close();
-        replay(out);
-
-        final LoggerFilterOutputStream los = new LoggerFilterOutputStream(out, getExtendedLogger(), LEVEL);
-        los.flush();
-        los.close();
-        verify(out);
-    }
-
-    @Test
-    public void testWrite_Character() throws Exception {
-        for (final char c : FIRST.toCharArray()) {
-            this.writer.write(c);
-            assertMessages();
-        }
-        this.writer.write('\n');
-        assertMessages(FIRST);
-        if (this.wrapped != null) {
-            assertEquals(FIRST + '\n', this.wrapped.toString());
-        }
-    }
-
-    @Test
-    public void testWrite_CharArray() throws Exception {
-        final char[] chars = FIRST.toCharArray();
-        this.writer.write(chars);
-        assertMessages();
-        this.writer.write('\n');
-        assertMessages(FIRST);
-        if (this.wrapped != null) {
-            assertEquals(FIRST + '\n', this.wrapped.toString());
-        }
-    }
-
-    @Test
-    public void testWrite_CharArray_Offset_Length() throws Exception {
-        final char[] chars = FIRST.toCharArray();
-        final int middle = chars.length / 2;
-        final int length = chars.length - middle;
-        final String right = new String(chars, middle, length);
-        this.writer.write(chars, middle, length);
-        assertMessages();
-        this.writer.write('\n');
-        assertMessages(right);
-        if (this.wrapped != null) {
-            assertEquals(FIRST.substring(middle, FIRST.length()) + '\n', this.wrapped.toString());
-        }
-    }
-
-    @Test
-    public void testWrite_IgnoresWindowsNewline() throws IOException {
-        this.writer.write(FIRST + "\r\n");
-        this.writer.write(LAST);
-        this.writer.close();
-        assertMessages(FIRST, LAST);
-        if (this.wrapped != null) {
-            assertEquals(FIRST + "\r\n" + LAST, this.wrapped.toString());
-        }
-    }
-
-    @Test
-    public void testWrite_MultipleLines() throws IOException {
-        this.writer.write(FIRST + '\n' + LAST + '\n');
-        assertMessages(FIRST, LAST);
-        if (this.wrapped != null) {
-            assertEquals(FIRST + '\n' + LAST + '\n', this.wrapped.toString());
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ffc1a38a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/AbstractStreamTest.java
----------------------------------------------------------------------
diff --git a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/AbstractStreamTest.java b/log4j-streams/src/test/java/org/apache/logging/log4j/streams/AbstractStreamTest.java
deleted file mode 100644
index 3fd6658..0000000
--- a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/AbstractStreamTest.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.logging.log4j.streams;
-
-import static org.hamcrest.core.StringStartsWith.startsWith;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
-
-import java.util.List;
-
-import org.apache.logging.log4j.Level;
-import org.apache.logging.log4j.Logger;
-import org.apache.logging.log4j.junit.InitialLoggerContext;
-import org.apache.logging.log4j.spi.ExtendedLogger;
-import org.apache.logging.log4j.test.appender.ListAppender;
-import org.junit.Before;
-import org.junit.ClassRule;
-
-public abstract class AbstractStreamTest {
-    
-    protected static Logger getLogger() {
-        return getExtendedLogger();
-    }
-    
-    protected static ExtendedLogger getExtendedLogger() {
-        return ctx.getLogger("UnitTestLogger");
-    }
-    
-    protected final static String NEWLINE = System.getProperty("line.separator");
-    protected final static Level LEVEL = Level.ERROR;
-    protected final static String FIRST = "first";
-
-    protected final static String LAST = "last";
-
-    @ClassRule
-    public static InitialLoggerContext ctx = new InitialLoggerContext("log4j2-streams-unit-test.xml");
-
-    protected void assertMessages(final String... messages) {
-        final List<String> actualMsgs = ((ListAppender) ctx.getAppender("UnitTest")).getMessages();
-        assertEquals("Unexpected number of results.", messages.length, actualMsgs.size());
-        for (int i = 0; i < messages.length; i++) {
-            final String start = LEVEL.name() + ' ' + messages[i];
-            assertThat(actualMsgs.get(i), startsWith(start));
-        }
-    }
-
-    @Before
-    public void clearAppender() {
-        ((ListAppender) ctx.getAppender("UnitTest")).clear();
-    }
-}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ffc1a38a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerBufferedInputStreamCallerInfoTest.java
----------------------------------------------------------------------
diff --git a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerBufferedInputStreamCallerInfoTest.java b/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerBufferedInputStreamCallerInfoTest.java
deleted file mode 100644
index 079deb1..0000000
--- a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerBufferedInputStreamCallerInfoTest.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.logging.log4j.streams;
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-
-import org.junit.Before;
-import org.junit.Test;
-
-public class LoggerBufferedInputStreamCallerInfoTest extends LoggerStreamsCallerInfoTesting {
-
-    private LoggerBufferedInputStream logIn;
-    
-    @Test
-    public void close() throws Exception {
-        this.logIn.read();
-        assertMessages("before close", 3, "close");
-        this.logIn.close();
-        assertMessages("after close", 4, "close");
-    }
-    
-    @Test
-    public void read() throws Exception {
-        this.logIn.read();
-
-        assertMessages("read", 3, "read");
-        this.logIn.close();
-    }
-
-    @Test
-    public void readBytes() throws Exception {
-        this.logIn.read(new byte[2]);
-
-        assertMessages("read", 3, "readBytes");
-        this.logIn.close();
-    }
-
-    @Test
-    public void readBytesOffsetLen() throws Exception {
-        this.logIn.read(new byte[2], 0, 2);
-
-        assertMessages("read", 3, "readBytesOffsetLen");
-        this.logIn.close();
-    }
-
-    @Before
-    public void setupStreams() {
-        final InputStream srcInputStream = new ByteArrayInputStream("a\nb\nc\nd".getBytes());
-        this.logIn = new LoggerBufferedInputStream(srcInputStream, getLogger(), LEVEL);
-    }
-}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ffc1a38a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerBufferedInputStreamTest.java
----------------------------------------------------------------------
diff --git a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerBufferedInputStreamTest.java b/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerBufferedInputStreamTest.java
deleted file mode 100644
index b11a31a..0000000
--- a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerBufferedInputStreamTest.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.logging.log4j.streams;
-
-import java.io.InputStream;
-
-import org.apache.logging.log4j.Level;
-
-public class LoggerBufferedInputStreamTest extends LoggerInputStreamTest {
-
-    @Override
-    protected InputStream createInputStream() {
-        return new LoggerBufferedInputStream(this.wrapped, getExtendedLogger(), Level.ERROR);
-    }
-}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ffc1a38a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerBufferedReaderCallerInfoTest.java
----------------------------------------------------------------------
diff --git a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerBufferedReaderCallerInfoTest.java b/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerBufferedReaderCallerInfoTest.java
deleted file mode 100644
index b723651..0000000
--- a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerBufferedReaderCallerInfoTest.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.logging.log4j.streams;
-
-import java.io.Reader;
-import java.io.StringReader;
-import java.nio.CharBuffer;
-
-import org.apache.logging.log4j.Level;
-import org.junit.Before;
-import org.junit.Test;
-
-public class LoggerBufferedReaderCallerInfoTest extends LoggerStreamsCallerInfoTesting {
-
-    LoggerBufferedReader logReader;
-    
-    @Test
-    public void close() throws Exception {
-        this.logReader.readLine();
-        assertMessages("before close", 3, "close");
-        this.logReader.close();
-        assertMessages("after close", 4, "close");
-    }
-
-    @Test
-    public void read() throws Exception {
-        this.logReader.read();
-
-        assertMessages("read", 3, "read");
-        this.logReader.close();
-    }
-
-    @Test
-    public void readCbuf() throws Exception {
-        this.logReader.read(new char[2]);
-
-        assertMessages("read", 3, "readCbuf");
-        this.logReader.close();
-    }
-
-    @Test
-    public void readCbufOffset() throws Exception {
-        this.logReader.read(new char[2], 0, 2);
-
-        assertMessages("read", 3, "readCbufOffset");
-        this.logReader.close();
-    }
-
-    @Test
-    public void readCharBuffer() throws Exception {
-        this.logReader.read(CharBuffer.allocate(2));
-
-        assertMessages("read", 3, "readCharBuffer");
-        this.logReader.close();
-    }
-
-    @Test
-    public void readLine() throws Exception {
-        this.logReader.readLine();
-
-        assertMessages("read", 3, "readLine");
-        this.logReader.close();
-    }
-
-    @Before
-    public void setupReader() {
-        final Reader srcReader = new StringReader("a\nb\nc\nd");
-        this.logReader = new LoggerBufferedReader(srcReader, getLogger(), Level.WARN);
-    }
-}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ffc1a38a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerBufferedReaderTest.java
----------------------------------------------------------------------
diff --git a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerBufferedReaderTest.java b/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerBufferedReaderTest.java
deleted file mode 100644
index 1e4ecc8..0000000
--- a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerBufferedReaderTest.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.logging.log4j.streams;
-
-import static org.junit.Assert.assertEquals;
-
-import java.io.BufferedReader;
-import java.io.Reader;
-
-import org.junit.Test;
-
-public class LoggerBufferedReaderTest extends LoggerReaderTest {
-    private BufferedReader bufferedReader;
-    
-    @Override
-    protected Reader createReader() {
-        return this.bufferedReader = new LoggerBufferedReader(this.wrapped, getExtendedLogger(), LEVEL);
-    }
-
-    @Test
-    public void testReadLine() throws Exception {
-        assertEquals("first line", FIRST, this.bufferedReader.readLine());
-        assertMessages(FIRST);
-        assertEquals("second line", LAST, this.bufferedReader.readLine());
-        assertMessages(FIRST, LAST);
-    }
-}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ffc1a38a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerFilterOutputStreamTest.java
----------------------------------------------------------------------
diff --git a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerFilterOutputStreamTest.java b/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerFilterOutputStreamTest.java
deleted file mode 100644
index 5b05775..0000000
--- a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerFilterOutputStreamTest.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.logging.log4j.streams;
-
-import java.io.ByteArrayOutputStream;
-import java.io.OutputStream;
-
-import org.apache.logging.log4j.Level;
-
-public class LoggerFilterOutputStreamTest extends AbstractLoggerOutputStreamTest {
-
-    @Override
-    protected ByteArrayOutputStream createOutputStream() {
-        return new ByteArrayOutputStream();
-    }
-
-    @Override
-    protected OutputStream createOutputStreamWrapper() {
-        return new LoggerFilterOutputStream(this.wrapped, getExtendedLogger(), Level.ERROR);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ffc1a38a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerFilterWriterTest.java
----------------------------------------------------------------------
diff --git a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerFilterWriterTest.java b/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerFilterWriterTest.java
deleted file mode 100644
index 99a1207..0000000
--- a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerFilterWriterTest.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package org.apache.logging.log4j.streams;
-
-import java.io.StringWriter;
-import java.io.Writer;
-
-public class LoggerFilterWriterTest extends AbstractLoggerWriterTest {
-
-    @Override
-    protected StringWriter createWriter() {
-        return new StringWriter();
-    }
-
-    @Override
-    protected Writer createWriterWrapper() {
-        return new LoggerFilterWriter(this.wrapped, getExtendedLogger(), LEVEL);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ffc1a38a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerInputStreamCallerInfoTest.java
----------------------------------------------------------------------
diff --git a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerInputStreamCallerInfoTest.java b/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerInputStreamCallerInfoTest.java
deleted file mode 100644
index 6037c3e..0000000
--- a/log4j-streams/src/test/java/org/apache/logging/log4j/streams/LoggerInputStreamCallerInfoTest.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.logging.log4j.streams;
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-
-import org.apache.logging.log4j.Level;
-import org.junit.Before;
-import org.junit.Test;
-
-public class LoggerInputStreamCallerInfoTest extends LoggerStreamsCallerInfoTesting {
-
-    private LoggerInputStream logIn;
-    
-    @Test
-    public void read() throws Exception {
-        this.logIn.read();
-        assertMessages("before read int size", 0, "read");
-        this.logIn.read();
-        assertMessages("after read int size", 1, "read");
-
-        this.logIn.read(new byte[2]);
-        assertMessages("after read bytes size", 2, "read");
-
-        this.logIn.read(new byte[2], 0, 2);
-        assertMessages("after read bytes offset size", 3, "read");
-
-        this.logIn.read();
-        assertMessages("before close size", 3, "read");
-        this.logIn.close();
-        assertMessages("after close size", 4, "read");
-    }
-    
-    @Before
-    public void setupStreams() {
-        final InputStream srcInputStream = new ByteArrayInputStream("a\nb\nc\nd".getBytes());
-        this.logIn = new LoggerInputStream(srcInputStream, getLogger(), Level.WARN);
-    }
-}


[3/6] Rename log4j-streams to log4j-iostreams.

Posted by ma...@apache.org.
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ffc1a38a/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/AbstractLoggerWriterTest.java
----------------------------------------------------------------------
diff --git a/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/AbstractLoggerWriterTest.java b/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/AbstractLoggerWriterTest.java
new file mode 100644
index 0000000..6fe81bc
--- /dev/null
+++ b/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/AbstractLoggerWriterTest.java
@@ -0,0 +1,138 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.logging.log4j.io;
+
+import static org.easymock.EasyMock.replay;
+import static org.easymock.EasyMock.verify;
+import static org.junit.Assert.assertEquals;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.StringWriter;
+import java.io.Writer;
+
+import org.easymock.EasyMock;
+import org.junit.Before;
+import org.junit.Test;
+
+public abstract class AbstractLoggerWriterTest extends AbstractStreamTest {
+    protected StringWriter wrapped;
+    protected Writer writer;
+
+    @Before
+    public void createStream() {
+        this.wrapped = createWriter();
+        this.writer = createWriterWrapper();
+    }
+
+    protected abstract StringWriter createWriter();
+
+    protected abstract Writer createWriterWrapper();
+
+    @Test
+    public void testClose_HasRemainingData() throws IOException {
+        this.writer.write(FIRST);
+        assertMessages();
+        this.writer.close();
+        assertMessages(FIRST);
+        if (this.wrapped != null) {
+            assertEquals(FIRST, this.wrapped.toString());
+        }
+    }
+
+    @Test
+    public void testClose_NoRemainingData() throws IOException {
+        this.writer.close();
+        assertMessages();
+        if (this.wrapped != null) {
+            assertEquals("", this.wrapped.toString());
+        }
+    }
+
+    @Test
+    public void testFlush() throws IOException {
+        final OutputStream out = EasyMock.createMock(OutputStream.class);
+        out.flush(); // expect the flush to come through to the mocked OutputStream
+        out.close();
+        replay(out);
+
+        final LoggerFilterOutputStream los = new LoggerFilterOutputStream(out, getExtendedLogger(), LEVEL);
+        los.flush();
+        los.close();
+        verify(out);
+    }
+
+    @Test
+    public void testWrite_Character() throws Exception {
+        for (final char c : FIRST.toCharArray()) {
+            this.writer.write(c);
+            assertMessages();
+        }
+        this.writer.write('\n');
+        assertMessages(FIRST);
+        if (this.wrapped != null) {
+            assertEquals(FIRST + '\n', this.wrapped.toString());
+        }
+    }
+
+    @Test
+    public void testWrite_CharArray() throws Exception {
+        final char[] chars = FIRST.toCharArray();
+        this.writer.write(chars);
+        assertMessages();
+        this.writer.write('\n');
+        assertMessages(FIRST);
+        if (this.wrapped != null) {
+            assertEquals(FIRST + '\n', this.wrapped.toString());
+        }
+    }
+
+    @Test
+    public void testWrite_CharArray_Offset_Length() throws Exception {
+        final char[] chars = FIRST.toCharArray();
+        final int middle = chars.length / 2;
+        final int length = chars.length - middle;
+        final String right = new String(chars, middle, length);
+        this.writer.write(chars, middle, length);
+        assertMessages();
+        this.writer.write('\n');
+        assertMessages(right);
+        if (this.wrapped != null) {
+            assertEquals(FIRST.substring(middle, FIRST.length()) + '\n', this.wrapped.toString());
+        }
+    }
+
+    @Test
+    public void testWrite_IgnoresWindowsNewline() throws IOException {
+        this.writer.write(FIRST + "\r\n");
+        this.writer.write(LAST);
+        this.writer.close();
+        assertMessages(FIRST, LAST);
+        if (this.wrapped != null) {
+            assertEquals(FIRST + "\r\n" + LAST, this.wrapped.toString());
+        }
+    }
+
+    @Test
+    public void testWrite_MultipleLines() throws IOException {
+        this.writer.write(FIRST + '\n' + LAST + '\n');
+        assertMessages(FIRST, LAST);
+        if (this.wrapped != null) {
+            assertEquals(FIRST + '\n' + LAST + '\n', this.wrapped.toString());
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ffc1a38a/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/AbstractStreamTest.java
----------------------------------------------------------------------
diff --git a/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/AbstractStreamTest.java b/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/AbstractStreamTest.java
new file mode 100644
index 0000000..b0bdc27
--- /dev/null
+++ b/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/AbstractStreamTest.java
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.logging.log4j.io;
+
+import static org.hamcrest.core.StringStartsWith.startsWith;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThat;
+
+import java.util.List;
+
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.junit.InitialLoggerContext;
+import org.apache.logging.log4j.spi.ExtendedLogger;
+import org.apache.logging.log4j.test.appender.ListAppender;
+import org.junit.Before;
+import org.junit.ClassRule;
+
+public abstract class AbstractStreamTest {
+    
+    protected static Logger getLogger() {
+        return getExtendedLogger();
+    }
+    
+    protected static ExtendedLogger getExtendedLogger() {
+        return ctx.getLogger("UnitTestLogger");
+    }
+    
+    protected final static String NEWLINE = System.getProperty("line.separator");
+    protected final static Level LEVEL = Level.ERROR;
+    protected final static String FIRST = "first";
+
+    protected final static String LAST = "last";
+
+    @ClassRule
+    public static InitialLoggerContext ctx = new InitialLoggerContext("log4j2-streams-unit-test.xml");
+
+    protected void assertMessages(final String... messages) {
+        final List<String> actualMsgs = ((ListAppender) ctx.getAppender("UnitTest")).getMessages();
+        assertEquals("Unexpected number of results.", messages.length, actualMsgs.size());
+        for (int i = 0; i < messages.length; i++) {
+            final String start = LEVEL.name() + ' ' + messages[i];
+            assertThat(actualMsgs.get(i), startsWith(start));
+        }
+    }
+
+    @Before
+    public void clearAppender() {
+        ((ListAppender) ctx.getAppender("UnitTest")).clear();
+    }
+}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ffc1a38a/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/LoggerBufferedInputStreamCallerInfoTest.java
----------------------------------------------------------------------
diff --git a/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/LoggerBufferedInputStreamCallerInfoTest.java b/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/LoggerBufferedInputStreamCallerInfoTest.java
new file mode 100644
index 0000000..860f3b8
--- /dev/null
+++ b/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/LoggerBufferedInputStreamCallerInfoTest.java
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.logging.log4j.io;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+
+import org.junit.Before;
+import org.junit.Test;
+
+public class LoggerBufferedInputStreamCallerInfoTest extends LoggerStreamsCallerInfoTesting {
+
+    private LoggerBufferedInputStream logIn;
+    
+    @Test
+    public void close() throws Exception {
+        this.logIn.read();
+        assertMessages("before close", 3, "close");
+        this.logIn.close();
+        assertMessages("after close", 4, "close");
+    }
+    
+    @Test
+    public void read() throws Exception {
+        this.logIn.read();
+
+        assertMessages("read", 3, "read");
+        this.logIn.close();
+    }
+
+    @Test
+    public void readBytes() throws Exception {
+        this.logIn.read(new byte[2]);
+
+        assertMessages("read", 3, "readBytes");
+        this.logIn.close();
+    }
+
+    @Test
+    public void readBytesOffsetLen() throws Exception {
+        this.logIn.read(new byte[2], 0, 2);
+
+        assertMessages("read", 3, "readBytesOffsetLen");
+        this.logIn.close();
+    }
+
+    @Before
+    public void setupStreams() {
+        final InputStream srcInputStream = new ByteArrayInputStream("a\nb\nc\nd".getBytes());
+        this.logIn = new LoggerBufferedInputStream(srcInputStream, getLogger(), LEVEL);
+    }
+}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ffc1a38a/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/LoggerBufferedInputStreamTest.java
----------------------------------------------------------------------
diff --git a/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/LoggerBufferedInputStreamTest.java b/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/LoggerBufferedInputStreamTest.java
new file mode 100644
index 0000000..d2ba6b0
--- /dev/null
+++ b/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/LoggerBufferedInputStreamTest.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.logging.log4j.io;
+
+import java.io.InputStream;
+
+import org.apache.logging.log4j.Level;
+
+public class LoggerBufferedInputStreamTest extends LoggerInputStreamTest {
+
+    @Override
+    protected InputStream createInputStream() {
+        return new LoggerBufferedInputStream(this.wrapped, getExtendedLogger(), Level.ERROR);
+    }
+}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ffc1a38a/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/LoggerBufferedReaderCallerInfoTest.java
----------------------------------------------------------------------
diff --git a/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/LoggerBufferedReaderCallerInfoTest.java b/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/LoggerBufferedReaderCallerInfoTest.java
new file mode 100644
index 0000000..2d9ff12
--- /dev/null
+++ b/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/LoggerBufferedReaderCallerInfoTest.java
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.logging.log4j.io;
+
+import java.io.Reader;
+import java.io.StringReader;
+import java.nio.CharBuffer;
+
+import org.apache.logging.log4j.Level;
+import org.junit.Before;
+import org.junit.Test;
+
+public class LoggerBufferedReaderCallerInfoTest extends LoggerStreamsCallerInfoTesting {
+
+    LoggerBufferedReader logReader;
+    
+    @Test
+    public void close() throws Exception {
+        this.logReader.readLine();
+        assertMessages("before close", 3, "close");
+        this.logReader.close();
+        assertMessages("after close", 4, "close");
+    }
+
+    @Test
+    public void read() throws Exception {
+        this.logReader.read();
+
+        assertMessages("read", 3, "read");
+        this.logReader.close();
+    }
+
+    @Test
+    public void readCbuf() throws Exception {
+        this.logReader.read(new char[2]);
+
+        assertMessages("read", 3, "readCbuf");
+        this.logReader.close();
+    }
+
+    @Test
+    public void readCbufOffset() throws Exception {
+        this.logReader.read(new char[2], 0, 2);
+
+        assertMessages("read", 3, "readCbufOffset");
+        this.logReader.close();
+    }
+
+    @Test
+    public void readCharBuffer() throws Exception {
+        this.logReader.read(CharBuffer.allocate(2));
+
+        assertMessages("read", 3, "readCharBuffer");
+        this.logReader.close();
+    }
+
+    @Test
+    public void readLine() throws Exception {
+        this.logReader.readLine();
+
+        assertMessages("read", 3, "readLine");
+        this.logReader.close();
+    }
+
+    @Before
+    public void setupReader() {
+        final Reader srcReader = new StringReader("a\nb\nc\nd");
+        this.logReader = new LoggerBufferedReader(srcReader, getLogger(), Level.WARN);
+    }
+}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ffc1a38a/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/LoggerBufferedReaderTest.java
----------------------------------------------------------------------
diff --git a/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/LoggerBufferedReaderTest.java b/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/LoggerBufferedReaderTest.java
new file mode 100644
index 0000000..68e1811
--- /dev/null
+++ b/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/LoggerBufferedReaderTest.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.logging.log4j.io;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.BufferedReader;
+import java.io.Reader;
+
+import org.junit.Test;
+
+public class LoggerBufferedReaderTest extends LoggerReaderTest {
+    private BufferedReader bufferedReader;
+    
+    @Override
+    protected Reader createReader() {
+        return this.bufferedReader = new LoggerBufferedReader(this.wrapped, getExtendedLogger(), LEVEL);
+    }
+
+    @Test
+    public void testReadLine() throws Exception {
+        assertEquals("first line", FIRST, this.bufferedReader.readLine());
+        assertMessages(FIRST);
+        assertEquals("second line", LAST, this.bufferedReader.readLine());
+        assertMessages(FIRST, LAST);
+    }
+}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ffc1a38a/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/LoggerFilterOutputStreamTest.java
----------------------------------------------------------------------
diff --git a/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/LoggerFilterOutputStreamTest.java b/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/LoggerFilterOutputStreamTest.java
new file mode 100644
index 0000000..60e48c5
--- /dev/null
+++ b/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/LoggerFilterOutputStreamTest.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.logging.log4j.io;
+
+import java.io.ByteArrayOutputStream;
+import java.io.OutputStream;
+
+import org.apache.logging.log4j.Level;
+
+public class LoggerFilterOutputStreamTest extends AbstractLoggerOutputStreamTest {
+
+    @Override
+    protected ByteArrayOutputStream createOutputStream() {
+        return new ByteArrayOutputStream();
+    }
+
+    @Override
+    protected OutputStream createOutputStreamWrapper() {
+        return new LoggerFilterOutputStream(this.wrapped, getExtendedLogger(), Level.ERROR);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ffc1a38a/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/LoggerFilterWriterTest.java
----------------------------------------------------------------------
diff --git a/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/LoggerFilterWriterTest.java b/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/LoggerFilterWriterTest.java
new file mode 100644
index 0000000..a58a51e
--- /dev/null
+++ b/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/LoggerFilterWriterTest.java
@@ -0,0 +1,18 @@
+package org.apache.logging.log4j.io;
+
+import java.io.StringWriter;
+import java.io.Writer;
+
+public class LoggerFilterWriterTest extends AbstractLoggerWriterTest {
+
+    @Override
+    protected StringWriter createWriter() {
+        return new StringWriter();
+    }
+
+    @Override
+    protected Writer createWriterWrapper() {
+        return new LoggerFilterWriter(this.wrapped, getExtendedLogger(), LEVEL);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ffc1a38a/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/LoggerInputStreamCallerInfoTest.java
----------------------------------------------------------------------
diff --git a/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/LoggerInputStreamCallerInfoTest.java b/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/LoggerInputStreamCallerInfoTest.java
new file mode 100644
index 0000000..bd812aa
--- /dev/null
+++ b/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/LoggerInputStreamCallerInfoTest.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.logging.log4j.io;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+
+import org.apache.logging.log4j.Level;
+import org.junit.Before;
+import org.junit.Test;
+
+public class LoggerInputStreamCallerInfoTest extends LoggerStreamsCallerInfoTesting {
+
+    private LoggerInputStream logIn;
+    
+    @Test
+    public void read() throws Exception {
+        this.logIn.read();
+        assertMessages("before read int size", 0, "read");
+        this.logIn.read();
+        assertMessages("after read int size", 1, "read");
+
+        this.logIn.read(new byte[2]);
+        assertMessages("after read bytes size", 2, "read");
+
+        this.logIn.read(new byte[2], 0, 2);
+        assertMessages("after read bytes offset size", 3, "read");
+
+        this.logIn.read();
+        assertMessages("before close size", 3, "read");
+        this.logIn.close();
+        assertMessages("after close size", 4, "read");
+    }
+    
+    @Before
+    public void setupStreams() {
+        final InputStream srcInputStream = new ByteArrayInputStream("a\nb\nc\nd".getBytes());
+        this.logIn = new LoggerInputStream(srcInputStream, getLogger(), Level.WARN);
+    }
+}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ffc1a38a/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/LoggerInputStreamTest.java
----------------------------------------------------------------------
diff --git a/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/LoggerInputStreamTest.java b/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/LoggerInputStreamTest.java
new file mode 100644
index 0000000..cd727a6
--- /dev/null
+++ b/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/LoggerInputStreamTest.java
@@ -0,0 +1,127 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.logging.log4j.io;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.BufferedInputStream;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.junit.Before;
+import org.junit.Test;
+
+public class LoggerInputStreamTest extends AbstractStreamTest {
+    protected ByteArrayInputStream wrapped;
+    protected ByteArrayOutputStream read;
+    protected InputStream in;
+
+    protected InputStream createInputStream() {
+        return new LoggerInputStream(this.wrapped, getExtendedLogger(), LEVEL);
+    }
+
+    @Before
+    public void createStream() {
+        this.wrapped = new ByteArrayInputStream((FIRST + "\r\n" + LAST).getBytes());
+        this.read = new ByteArrayOutputStream();
+        this.in = createInputStream();
+    }
+    
+    @Test
+    public void testClose_HasRemainingData() throws IOException {
+        final byte[] bytes = new byte[1024];
+        this.in.read(bytes);
+        assertMessages(FIRST);
+        this.in.close();
+        assertMessages(FIRST, LAST);
+    }
+
+    @Test
+    public void testClose_NoRemainingData() throws IOException {
+        this.wrapped = new ByteArrayInputStream((FIRST + '\n').getBytes());
+        this.in = new LoggerInputStream(this.wrapped, getExtendedLogger(), LEVEL);
+
+        final byte[] bytes = new byte[1024];
+        this.in.read(bytes);
+        assertMessages(FIRST);
+        this.in.close();
+        assertMessages(FIRST);
+    }
+
+    @Test
+    public void testRead_ByteArray() throws Exception {
+        final byte[] bytes = new byte[FIRST.length()];
+        assertEquals("len", bytes.length, this.in.read(bytes));
+        if (!(this.in instanceof BufferedInputStream)) {
+            assertMessages();
+        }
+        this.in.read(bytes);
+        assertMessages(FIRST);
+    }
+
+    @Test
+    public void testRead_ByteArray_Offset_Length() throws Exception {
+        final byte[] bytes = new byte[FIRST.length() * 2];
+        assertEquals("len", FIRST.length(), this.in.read(bytes, 0, FIRST.length()));
+        if (!(this.in instanceof BufferedInputStream)) {
+            assertMessages();
+        }
+        this.in.read(bytes);
+        assertMessages(FIRST);
+    }
+
+    @Test
+    public void testRead_IgnoresWindowsNewline() throws IOException {
+        final byte[] bytes = new byte[1024];
+        final int len = this.in.read(bytes);
+        this.read.write(bytes, 0, len);
+        assertMessages(FIRST);
+        assertEquals(FIRST + "\r\n" + LAST, this.read.toString());
+        this.in.close();
+        assertMessages(FIRST, LAST);
+    }
+
+    @Test
+    public void testRead_int() throws Exception {
+        for (int i = 0; i < FIRST.length(); i++) {
+            this.read.write(this.in.read());
+        }
+        if (!(this.in instanceof BufferedInputStream)) {
+            assertMessages();
+        }
+        assertEquals("carriage return", '\r', this.in.read());
+        if (!(this.in instanceof BufferedInputStream)) {
+            assertMessages();
+        }
+        assertEquals("newline", '\n', this.in.read());
+        assertMessages(FIRST);
+    }
+
+    @Test
+    public void testRead_MultipleLines() throws IOException {
+        this.wrapped = new ByteArrayInputStream((FIRST + "\n" + LAST + '\n').getBytes());
+        this.in = new LoggerInputStream(this.wrapped, getExtendedLogger(), LEVEL);
+
+        final byte[] bytes = new byte[1024];
+        final int len = this.in.read(bytes);
+        this.read.write(bytes, 0, len);
+        assertMessages(FIRST, LAST);
+        assertEquals(FIRST + '\n' + LAST + '\n', this.read.toString());
+    }
+}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ffc1a38a/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/LoggerOutputStreamCallerInfoTest.java
----------------------------------------------------------------------
diff --git a/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/LoggerOutputStreamCallerInfoTest.java b/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/LoggerOutputStreamCallerInfoTest.java
new file mode 100644
index 0000000..c013fc6
--- /dev/null
+++ b/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/LoggerOutputStreamCallerInfoTest.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.logging.log4j.io;
+
+import org.apache.logging.log4j.Level;
+import org.junit.Before;
+import org.junit.Test;
+
+public class LoggerOutputStreamCallerInfoTest extends LoggerStreamsCallerInfoTesting {
+
+    private LoggerOutputStream logOut;
+    
+    @Before
+    public void setupStreams() {
+        this.logOut = new LoggerOutputStream(getExtendedLogger(), Level.WARN);
+    }
+    
+    @Test
+    public void write() throws Exception {
+        this.logOut.write('a');
+        assertMessages("before write int", 0, "write");
+        this.logOut.write('\n');
+        assertMessages("after write int", 1, "write");
+        
+        this.logOut.write("b\n".getBytes());
+        assertMessages("after write byte array", 2, "write");
+
+        this.logOut.write("c\n".getBytes(), 0, 2);
+        assertMessages("after write byte array offset size", 3, "write");
+
+        this.logOut.write('d');
+        assertMessages("before close size", 3, "write");
+        this.logOut.close();
+        assertMessages("after close size", 4, "write");
+    }
+}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ffc1a38a/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/LoggerOutputStreamTest.java
----------------------------------------------------------------------
diff --git a/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/LoggerOutputStreamTest.java b/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/LoggerOutputStreamTest.java
new file mode 100644
index 0000000..1631336
--- /dev/null
+++ b/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/LoggerOutputStreamTest.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.logging.log4j.io;
+
+import java.io.ByteArrayOutputStream;
+import java.io.OutputStream;
+
+import org.apache.logging.log4j.Level;
+
+public class LoggerOutputStreamTest extends AbstractLoggerOutputStreamTest {
+
+    @Override
+    protected ByteArrayOutputStream createOutputStream() {
+        return null;
+    }
+
+    @Override
+    protected OutputStream createOutputStreamWrapper() {
+        return new LoggerOutputStream(getExtendedLogger(), Level.ERROR);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ffc1a38a/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/LoggerPrintStreamCallerInfoTest.java
----------------------------------------------------------------------
diff --git a/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/LoggerPrintStreamCallerInfoTest.java b/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/LoggerPrintStreamCallerInfoTest.java
new file mode 100644
index 0000000..2c533c3
--- /dev/null
+++ b/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/LoggerPrintStreamCallerInfoTest.java
@@ -0,0 +1,146 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.logging.log4j.io;
+
+import java.io.UnsupportedEncodingException;
+import java.util.Locale;
+
+import org.apache.logging.log4j.Level;
+import org.junit.Before;
+import org.junit.Test;
+
+public class LoggerPrintStreamCallerInfoTest extends LoggerStreamsCallerInfoTesting {
+
+    private LoggerPrintStream logOut;
+    
+    @Test
+    public void close() throws Exception {
+        this.logOut.print("a\nb");
+        assertMessages("before close size", 1, "close");
+        this.logOut.close();
+        assertMessages("after close size", 2, "close");
+    }
+    
+    @Test
+    public void print_boolean() throws Exception {
+        this.logOut.print(true);
+        assertMessages("print", 0, "print_boolean");
+        this.logOut.println(true);
+        assertMessages("println", 1, "print_boolean");
+    }
+    
+    @Test
+    public void print_char() throws Exception {
+        this.logOut.print('a');
+        assertMessages("print", 0, "print_char");
+        this.logOut.println('b');
+        assertMessages("println", 1, "print_char");
+    }
+    
+    @Test
+    public void print_chararray() throws Exception {
+        this.logOut.print("a".toCharArray());
+        assertMessages("print", 0, "print_chararray");
+        this.logOut.println("b".toCharArray());
+        assertMessages("println", 1, "print_chararray");
+    }
+    
+    @Test
+    public void print_double() throws Exception {
+        this.logOut.print(1D);
+        assertMessages("print", 0, "print_double");
+        this.logOut.println(2D);
+        assertMessages("println", 1, "print_double");
+    }
+    
+    @Test
+    public void print_float() throws Exception {
+        this.logOut.print(1f);
+        assertMessages("print", 0, "print_float");
+        this.logOut.println(2f);
+        assertMessages("println", 1, "print_float");
+    }
+    
+    @Test
+    public void print_int() throws Exception {
+        this.logOut.print(1);
+        assertMessages("print", 0, "print_int");
+        this.logOut.println(2);
+        assertMessages("println", 1, "print_int");
+    }
+    
+    @Test
+    public void print_long() throws Exception {
+        this.logOut.print(1L);
+        assertMessages("print", 0, "print_long");
+        this.logOut.println(2L);
+        assertMessages("println", 1, "print_long");
+    }
+    
+    @Test
+    public void print_object() throws Exception {
+        this.logOut.print((Object) 'a');
+        assertMessages("print", 0, "print_object");
+        this.logOut.println((Object) 'b');
+        assertMessages("println", 1, "print_object");
+    }
+    
+    @Test
+    public void print_printf() throws Exception {
+        this.logOut.printf("a\n");
+        assertMessages("println", 1, "print_printf");
+    }
+    
+    @Test
+    public void print_printf_locale() throws Exception {
+        this.logOut.printf(Locale.getDefault(), "a\n");
+        assertMessages("println", 1, "print_printf_locale");
+    }
+    
+    @Test
+    public void print_string() throws Exception {
+        this.logOut.print("a");
+        assertMessages("print", 0, "print_string");
+        this.logOut.println("b");
+        assertMessages("println", 1, "print_string");
+    }
+    
+    @Before
+    public void setupStreams() throws UnsupportedEncodingException {
+        this.logOut = new LoggerPrintStream(getLogger(), Level.WARN);
+    }
+    
+    @Test
+    public void write_bytes() throws Exception {
+        this.logOut.write("b\n".getBytes());
+        assertMessages("write", 1, "write_bytes");
+    }
+    
+    @Test
+    public void write_bytes_offset() throws Exception {
+        this.logOut.write("c\n".getBytes(), 0, 2);
+        assertMessages("write", 1, "write_bytes_offset");
+    }
+    
+    @Test
+    public void write_int() throws Exception {
+        this.logOut.write('a');
+        assertMessages("write int", 0, "write_int");
+        this.logOut.write('\n');
+        assertMessages("write newline", 1, "write_int");
+    }
+}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ffc1a38a/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/LoggerPrintStreamTest.java
----------------------------------------------------------------------
diff --git a/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/LoggerPrintStreamTest.java b/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/LoggerPrintStreamTest.java
new file mode 100644
index 0000000..38dd793
--- /dev/null
+++ b/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/LoggerPrintStreamTest.java
@@ -0,0 +1,122 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.logging.log4j.io;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertSame;
+
+import java.io.ByteArrayOutputStream;
+import java.io.OutputStream;
+
+import org.junit.Test;
+
+public class LoggerPrintStreamTest extends AbstractLoggerOutputStreamTest {
+    private LoggerPrintStream print;
+
+    @Override
+    protected ByteArrayOutputStream createOutputStream() {
+        return new ByteArrayOutputStream();
+    }
+
+    @Override
+    protected OutputStream createOutputStreamWrapper() {
+        return this.print = new LoggerPrintStream(this.wrapped, getExtendedLogger(), LEVEL);
+    }
+
+    @Test
+    public void testFormat() throws Exception {
+        assertSame(this.print, this.print.format("[%s]", FIRST));
+        assertMessages();
+        this.print.println();
+        assertMessages("[" + FIRST + "]");
+        assertEquals("[" + FIRST + "]" + NEWLINE, this.wrapped.toString());
+    }
+
+    @Test
+    public void testPrint_boolean() throws Exception {
+        this.print.print(true);
+        assertMessages();
+        this.print.println();
+        assertMessages("true");
+        assertEquals("true" + NEWLINE, this.wrapped.toString());
+    }
+
+    @Test
+    public void testPrint_char() throws Exception {
+        for (final char c : FIRST.toCharArray()) {
+            this.print.print(c);
+            assertMessages();
+        }
+        this.print.println();
+        assertMessages(FIRST);
+        assertEquals(FIRST + NEWLINE, this.wrapped.toString());
+    }
+
+    @Test
+    public void testPrint_CharacterArray() throws Exception {
+        this.print.print(FIRST.toCharArray());
+        assertMessages();
+        this.print.println();
+        assertMessages(FIRST);
+        assertEquals(FIRST + NEWLINE, this.wrapped.toString());
+    }
+
+    @Test
+    public void testPrint_int() throws Exception {
+        this.print.print(12);
+        assertMessages();
+        this.print.println();
+        assertMessages("12");
+        assertEquals("12" + NEWLINE, this.wrapped.toString());
+    }
+
+    @Test
+    public void testPrint_long() throws Exception {
+        this.print.print(12L);
+        assertMessages();
+        this.print.println();
+        assertMessages("12");
+        assertEquals("12" + NEWLINE, this.wrapped.toString());
+    }
+
+    @Test
+    public void testPrint_Object() throws Exception {
+        this.print.print((Object) FIRST);
+        assertMessages();
+        this.print.println();
+        assertMessages(FIRST);
+        assertEquals(FIRST + NEWLINE, this.wrapped.toString());
+    }
+
+    @Test
+    public void testPrint_String() throws Exception {
+        this.print.print(FIRST);
+        assertMessages();
+        this.print.println();
+        assertMessages(FIRST);
+        assertEquals(FIRST + NEWLINE, this.wrapped.toString());
+    }
+
+    @Test
+    public void testPrintf() throws Exception {
+        assertSame(this.print,  this.print.printf("<<<%s>>>", FIRST));
+        assertMessages();
+        this.print.println();
+        assertMessages("<<<" + FIRST + ">>>");
+        assertEquals("<<<" + FIRST + ">>>" + NEWLINE, this.wrapped.toString());
+    }
+}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ffc1a38a/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/LoggerPrintWriterCallerInfoTest.java
----------------------------------------------------------------------
diff --git a/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/LoggerPrintWriterCallerInfoTest.java b/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/LoggerPrintWriterCallerInfoTest.java
new file mode 100644
index 0000000..7502040
--- /dev/null
+++ b/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/LoggerPrintWriterCallerInfoTest.java
@@ -0,0 +1,145 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.logging.log4j.io;
+
+import java.util.Locale;
+
+import org.apache.logging.log4j.Level;
+import org.junit.Before;
+import org.junit.Test;
+
+public class LoggerPrintWriterCallerInfoTest extends LoggerStreamsCallerInfoTesting {
+
+    private LoggerPrintWriter logOut;
+    
+    @Test
+    public void close() throws Exception {
+        this.logOut.print("a\nb");
+        assertMessages("before close size", 1, "close");
+        this.logOut.close();
+        assertMessages("after close size", 2, "close");
+    }
+    
+    @Test
+    public void print_boolean() throws Exception {
+        this.logOut.print(true);
+        assertMessages("print", 0, "print_boolean");
+        this.logOut.println(true);
+        assertMessages("println", 1, "print_boolean");
+    }
+    
+    @Test
+    public void print_char() throws Exception {
+        this.logOut.print('a');
+        assertMessages("print", 0, "print_char");
+        this.logOut.println('b');
+        assertMessages("println", 1, "print_char");
+    }
+    
+    @Test
+    public void print_chararray() throws Exception {
+        this.logOut.print("a".toCharArray());
+        assertMessages("print", 0, "print_chararray");
+        this.logOut.println("b".toCharArray());
+        assertMessages("println", 1, "print_chararray");
+    }
+    
+    @Test
+    public void print_double() throws Exception {
+        this.logOut.print(1D);
+        assertMessages("print", 0, "print_double");
+        this.logOut.println(2D);
+        assertMessages("println", 1, "print_double");
+    }
+    
+    @Test
+    public void print_float() throws Exception {
+        this.logOut.print(1f);
+        assertMessages("print", 0, "print_float");
+        this.logOut.println(2f);
+        assertMessages("println", 1, "print_float");
+    }
+    
+    @Test
+    public void print_int() throws Exception {
+        this.logOut.print(1);
+        assertMessages("print", 0, "print_int");
+        this.logOut.println(2);
+        assertMessages("println", 1, "print_int");
+    }
+    
+    @Test
+    public void print_long() throws Exception {
+        this.logOut.print(1L);
+        assertMessages("print", 0, "print_long");
+        this.logOut.println(2L);
+        assertMessages("println", 1, "print_long");
+    }
+    
+    @Test
+    public void print_object() throws Exception {
+        this.logOut.print((Object) 'a');
+        assertMessages("print", 0, "print_object");
+        this.logOut.println((Object) 'b');
+        assertMessages("println", 1, "print_object");
+    }
+    
+    @Test
+    public void print_printf() throws Exception {
+        this.logOut.printf("a\n");
+        assertMessages("println", 1, "print_printf");
+    }
+    
+    @Test
+    public void print_printf_locale() throws Exception {
+        this.logOut.printf(Locale.getDefault(), "a\n");
+        assertMessages("println", 1, "print_printf_locale");
+    }
+    
+    @Test
+    public void print_string() throws Exception {
+        this.logOut.print("a");
+        assertMessages("print", 0, "print_string");
+        this.logOut.println("b");
+        assertMessages("println", 1, "print_string");
+    }
+    
+    @Before
+    public void setupStreams() {
+        this.logOut = new LoggerPrintWriter(getLogger(), Level.WARN);
+    }
+    
+    @Test
+    public void write_bytes() throws Exception {
+        this.logOut.write("b\n".toCharArray());
+        assertMessages("write", 1, "write_bytes");
+    }
+    
+    @Test
+    public void write_bytes_offset() throws Exception {
+        this.logOut.write("c\n".toCharArray(), 0, 2);
+        assertMessages("write", 1, "write_bytes_offset");
+    }
+    
+    @Test
+    public void write_int() throws Exception {
+        this.logOut.write('a');
+        assertMessages("write int", 0, "write_int");
+        this.logOut.write('\n');
+        assertMessages("write newline", 1, "write_int");
+    }
+}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ffc1a38a/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/LoggerPrintWriterTest.java
----------------------------------------------------------------------
diff --git a/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/LoggerPrintWriterTest.java b/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/LoggerPrintWriterTest.java
new file mode 100644
index 0000000..7b13086
--- /dev/null
+++ b/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/LoggerPrintWriterTest.java
@@ -0,0 +1,124 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.logging.log4j.io;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertSame;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.io.Writer;
+
+import org.junit.Test;
+
+public class LoggerPrintWriterTest extends AbstractLoggerWriterTest {
+    private PrintWriter print; 
+
+    @Override
+    protected StringWriter createWriter() {
+        return new StringWriter();
+    }
+
+    @Override
+    protected Writer createWriterWrapper() {
+        this.print = new LoggerPrintWriter(this.wrapped, getExtendedLogger(), LEVEL);
+        return this.print;
+    }
+
+    @Test
+    public void testFormat() throws Exception {
+        assertSame(this.print, this.print.format("[%s]", FIRST));
+        assertMessages();
+        this.print.println();
+        assertMessages("[" + FIRST + "]");
+        assertEquals("[" + FIRST + "]" + NEWLINE, this.wrapped.toString());
+    }
+
+    @Test
+    public void testPrint_boolean() throws Exception {
+        this.print.print(true);
+        assertMessages();
+        this.print.println();
+        assertMessages("true");
+        assertEquals("true" + NEWLINE, this.wrapped.toString());
+    }
+
+    @Test
+    public void testPrint_char() throws Exception {
+        for (final char c : FIRST.toCharArray()) {
+            this.print.print(c);
+            assertMessages();
+        }
+        this.print.println();
+        assertMessages(FIRST);
+        assertEquals(FIRST + NEWLINE, this.wrapped.toString());
+    }
+
+    @Test
+    public void testPrint_CharacterArray() throws Exception {
+        this.print.print(FIRST.toCharArray());
+        assertMessages();
+        this.print.println();
+        assertMessages(FIRST);
+        assertEquals(FIRST + NEWLINE, this.wrapped.toString());
+    }
+
+    @Test
+    public void testPrint_int() throws Exception {
+        this.print.print(12);
+        assertMessages();
+        this.print.println();
+        assertMessages("12");
+        assertEquals("12" + NEWLINE, this.wrapped.toString());
+    }
+
+    @Test
+    public void testPrint_long() throws Exception {
+        this.print.print(12L);
+        assertMessages();
+        this.print.println();
+        assertMessages("12");
+        assertEquals("12" + NEWLINE, this.wrapped.toString());
+    }
+
+    @Test
+    public void testPrint_Object() throws Exception {
+        this.print.print((Object) FIRST);
+        assertMessages();
+        this.print.println();
+        assertMessages(FIRST);
+        assertEquals(FIRST + NEWLINE, this.wrapped.toString());
+    }
+
+    @Test
+    public void testPrint_String() throws Exception {
+        this.print.print(FIRST);
+        assertMessages();
+        this.print.println();
+        assertMessages(FIRST);
+        assertEquals(FIRST + NEWLINE, this.wrapped.toString());
+    }
+
+    @Test
+    public void testPrintf() throws Exception {
+        assertSame(this.print,  this.print.printf("<<<%s>>>", FIRST));
+        assertMessages();
+        this.print.println();
+        assertMessages("<<<" + FIRST + ">>>");
+        assertEquals("<<<" + FIRST + ">>>" + NEWLINE, this.wrapped.toString());
+    }
+}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ffc1a38a/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/LoggerReaderCallerInfoTest.java
----------------------------------------------------------------------
diff --git a/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/LoggerReaderCallerInfoTest.java b/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/LoggerReaderCallerInfoTest.java
new file mode 100644
index 0000000..5e114e3
--- /dev/null
+++ b/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/LoggerReaderCallerInfoTest.java
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.logging.log4j.io;
+
+import java.io.Reader;
+import java.io.StringReader;
+import java.nio.CharBuffer;
+
+import org.junit.Before;
+import org.junit.Test;
+
+public class LoggerReaderCallerInfoTest extends LoggerStreamsCallerInfoTesting {
+
+    LoggerReader logReader;
+    
+    @Test
+    public void read() throws Exception {
+        this.logReader.read();
+        assertMessages("before read int size", 0, "read");
+        this.logReader.read();
+        assertMessages("after read int size", 1, "read");
+
+        this.logReader.read(new char[2]);
+        assertMessages("after read bytes size", 2, "read");
+
+        this.logReader.read(new char[2], 0, 2);
+        assertMessages("after read bytes offset size", 3, "read");
+
+        this.logReader.read(CharBuffer.allocate(2));
+        assertMessages("after read charBuffer size", 4, "read");
+
+        this.logReader.read();
+        assertMessages("before close size", 4, "read");
+        this.logReader.close();
+        assertMessages("after close size", 5, "read");
+    }
+
+    @Before
+    public void setupReader() {
+        final Reader srcReader = new StringReader("a\nb\nc\nd\ne");
+        this.logReader = new LoggerReader(srcReader, getLogger(), LEVEL);
+    }
+}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ffc1a38a/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/LoggerReaderTest.java
----------------------------------------------------------------------
diff --git a/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/LoggerReaderTest.java b/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/LoggerReaderTest.java
new file mode 100644
index 0000000..4f89d7b
--- /dev/null
+++ b/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/LoggerReaderTest.java
@@ -0,0 +1,141 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.logging.log4j.io;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.Reader;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.nio.CharBuffer;
+
+import org.junit.Before;
+import org.junit.Test;
+
+public class LoggerReaderTest extends AbstractStreamTest {
+    protected StringReader wrapped;
+    protected StringWriter read;
+    protected Reader reader;
+
+    protected Reader createReader() {
+        return new LoggerReader(this.wrapped, getExtendedLogger(), LEVEL);
+    }
+    
+    @Before
+    public void createStream() {
+        this.wrapped = new StringReader(FIRST + "\r\n" + LAST);
+        this.read = new StringWriter();
+        this.reader = createReader();
+    }
+
+    @Test
+    public void testClose_HasRemainingData() throws IOException {
+        final char[] chars = new char[1024];
+        this.reader.read(chars);
+        if (!(this.reader instanceof BufferedReader)) {
+            assertMessages(FIRST);
+        }
+        this.reader.close();
+        assertMessages(FIRST, LAST);
+    }
+
+    @Test
+    public void testClose_NoRemainingData() throws IOException {
+        this.wrapped = new StringReader(FIRST + '\n');
+        this.reader = createReader();
+
+        final char[] chars = new char[1024];
+        this.reader.read(chars);
+        assertMessages(FIRST);
+        this.reader.close();
+        assertMessages(FIRST);
+    }
+
+    @Test
+    public void testRead_CharArray() throws Exception {
+        final char[] chars = new char[FIRST.length()];
+        assertEquals("len", FIRST.length(), this.reader.read(chars));
+        if (!(this.reader instanceof BufferedReader)) {
+            assertMessages();
+        }
+        this.reader.read(chars);
+        assertMessages(FIRST);
+    }
+
+    @Test
+    public void testRead_CharArray_Offset_Length() throws Exception {
+        final char[] chars = new char[1024];
+        assertEquals("len", FIRST.length(), this.reader.read(chars, 0, FIRST.length()));
+        if (!(this.reader instanceof BufferedReader)) {
+            assertMessages();
+        }
+        this.reader.read(chars);
+        this.reader.close();
+        assertMessages(FIRST, LAST);
+    }
+
+    @Test
+    public void testRead_CharBuffer() throws Exception {
+        final CharBuffer chars = CharBuffer.allocate(1024);
+        assertEquals("len", FIRST.length() + LAST.length() + 2, this.reader.read(chars));
+        this.reader.close();
+        assertMessages(FIRST, LAST);
+    }
+
+    @Test
+    public void testRead_IgnoresWindowsNewline() throws IOException {
+        final char[] chars = new char[1024];
+        final int len = this.reader.read(chars);
+        this.read.write(chars, 0, len);
+        if (!(this.reader instanceof BufferedReader)) {
+            assertMessages(FIRST);
+        }
+        assertEquals(FIRST + "\r\n" + LAST, this.read.toString());
+        this.reader.close();
+        assertMessages(FIRST, LAST);
+    }
+
+    @Test
+    public void testRead_int() throws Exception {
+        for (int i = 0; i < FIRST.length(); i++) {
+            this.read.write(this.reader.read());
+        }
+        if (!(this.reader instanceof BufferedReader)) {
+            assertMessages();
+        }
+        assertEquals("carriage return", '\r', this.reader.read());
+        if (!(this.reader instanceof BufferedReader)) {
+            assertMessages();
+        }
+        assertEquals("newline", '\n', this.reader.read());
+        assertMessages(FIRST);
+    }
+
+    @Test
+    public void testRead_MultipleLines() throws IOException {
+        this.wrapped = new StringReader(FIRST + "\n" + LAST + '\n');
+        this.reader = createReader();
+
+        final char[] chars = new char[1024];
+        final int len = this.reader.read(chars);
+        this.read.write(chars, 0, len);
+        assertMessages(FIRST, LAST);
+        assertEquals(FIRST + '\n' + LAST + '\n', this.read.toString());
+    }
+}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ffc1a38a/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/LoggerStreamsCallerInfoTesting.java
----------------------------------------------------------------------
diff --git a/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/LoggerStreamsCallerInfoTesting.java b/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/LoggerStreamsCallerInfoTesting.java
new file mode 100644
index 0000000..8f050b3
--- /dev/null
+++ b/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/LoggerStreamsCallerInfoTesting.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.logging.log4j.io;
+
+import static org.junit.Assert.assertEquals;
+
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.core.Logger;
+import org.apache.logging.log4j.junit.InitialLoggerContext;
+import org.apache.logging.log4j.test.appender.ListAppender;
+import org.junit.Before;
+import org.junit.ClassRule;
+
+public class LoggerStreamsCallerInfoTesting {
+
+    protected static Logger getExtendedLogger() {
+        return ctx.getLogger("ClassAndMethodLogger");
+    }
+    
+    protected static Logger getLogger() {
+        return getExtendedLogger();
+    }
+    
+    protected final static Level LEVEL = Level.WARN;
+
+    @ClassRule
+    public static InitialLoggerContext ctx = new InitialLoggerContext("log4j2-streams-calling-info.xml");
+
+    public void assertMessages(final String msg, final int size, final String methodName) {
+        final ListAppender appender = (ListAppender) ctx.getAppender("ClassAndMethod");
+        assertEquals(msg + ".size", size, appender.getMessages().size());
+        for (final String message : appender.getMessages()) {
+            assertEquals(msg + " has incorrect caller info", this.getClass().getName() + '.' + methodName, message);
+        }
+    }
+
+    @Before
+    public void clearAppender() {
+        ((ListAppender) ctx.getAppender("ClassAndMethod")).clear();
+    }
+}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ffc1a38a/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/LoggerWriterTest.java
----------------------------------------------------------------------
diff --git a/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/LoggerWriterTest.java b/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/LoggerWriterTest.java
new file mode 100644
index 0000000..3d261be
--- /dev/null
+++ b/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/LoggerWriterTest.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.logging.log4j.io;
+
+import java.io.StringWriter;
+import java.io.Writer;
+
+public class LoggerWriterTest extends AbstractLoggerWriterTest {
+
+    @Override
+    protected StringWriter createWriter() {
+        return null;
+    }
+
+    @Override
+    protected Writer createWriterWrapper() {
+        return new LoggerWriter(getExtendedLogger(), LEVEL);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ffc1a38a/log4j-iostreams/src/test/resources/log4j2-streams-calling-info.xml
----------------------------------------------------------------------
diff --git a/log4j-iostreams/src/test/resources/log4j2-streams-calling-info.xml b/log4j-iostreams/src/test/resources/log4j2-streams-calling-info.xml
new file mode 100644
index 0000000..5f8dfd9
--- /dev/null
+++ b/log4j-iostreams/src/test/resources/log4j2-streams-calling-info.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+<Configuration name="CallerInformationTest" status="error" packages="org.apache.logging.log4j.test">
+  <Appenders>
+    <List name="ClassAndMethod">
+      <PatternLayout pattern="%class.%method"/>
+    </List>
+  </Appenders>
+  <Loggers>
+    <Logger name="ClassAndMethodLogger" level="info">
+      <AppenderRef ref="ClassAndMethod"/>
+    </Logger>
+    <Root level="off"/>
+  </Loggers>
+</Configuration>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ffc1a38a/log4j-iostreams/src/test/resources/log4j2-streams-unit-test.xml
----------------------------------------------------------------------
diff --git a/log4j-iostreams/src/test/resources/log4j2-streams-unit-test.xml b/log4j-iostreams/src/test/resources/log4j2-streams-unit-test.xml
new file mode 100644
index 0000000..d6f0211
--- /dev/null
+++ b/log4j-iostreams/src/test/resources/log4j2-streams-unit-test.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+<Configuration name="UnitTest" status="error" packages="org.apache.logging.log4j.test">
+  <Appenders>
+    <List name="UnitTest">
+      <PatternLayout pattern="%level %m%n"/>
+    </List>
+  </Appenders>
+  <Loggers>
+    <Logger name="UnitTestLogger" level="info">
+      <AppenderRef ref="UnitTest"/>
+    </Logger>
+    <Root level="off"/>
+  </Loggers>
+</Configuration>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ffc1a38a/log4j-streams/.gitignore
----------------------------------------------------------------------
diff --git a/log4j-streams/.gitignore b/log4j-streams/.gitignore
deleted file mode 100644
index b79adc7..0000000
Binary files a/log4j-streams/.gitignore and /dev/null differ

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ffc1a38a/log4j-streams/pom.xml
----------------------------------------------------------------------
diff --git a/log4j-streams/pom.xml b/log4j-streams/pom.xml
deleted file mode 100644
index 5a38cc9..0000000
--- a/log4j-streams/pom.xml
+++ /dev/null
@@ -1,212 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  ~ Licensed to the Apache Software Foundation (ASF) under one or more
-  ~ contributor license agreements.  See the NOTICE file distributed with
-  ~ this work for additional information regarding copyright ownership.
-  ~ The ASF licenses this file to You under the Apache License, Version 2.0
-  ~ (the "License"); you may not use this file except in compliance with
-  ~ the License.  You may obtain a copy of the License at
-  ~
-  ~     http://www.apache.org/licenses/LICENSE-2.0
-  ~
-  ~ Unless required by applicable law or agreed to in writing, software
-  ~ distributed under the License is distributed on an "AS IS" BASIS,
-  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  ~ See the License for the specific language governing permissions and
-  ~ limitations under the License.
-  -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-  <modelVersion>4.0.0</modelVersion>
-  <parent>
-    <groupId>org.apache.logging.log4j</groupId>
-    <artifactId>log4j</artifactId>
-    <version>2.1-SNAPSHOT</version>
-    <relativePath>../</relativePath>
-  </parent>
-  <artifactId>log4j-streams</artifactId>
-  <version>2.1-SNAPSHOT</version>
-  <packaging>jar</packaging>
-  <name>Apache Log4j Streaming Interface</name>
-  <description>Provides the ability to convert streams into log statements</description>
-  <properties>
-    <log4jParentDir>${basedir}/..</log4jParentDir>
-    <docLabel>Streaming Documentation</docLabel>
-    <projectDir>/slf4j-streams</projectDir>
-  </properties>
-  <dependencies>
-    <dependency>
-      <groupId>org.apache.logging.log4j</groupId>
-      <artifactId>log4j-api</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.logging.log4j</groupId>
-      <artifactId>log4j-core</artifactId>
-      <scope>test</scope>
-    </dependency>
-
-    <!-- TEST DEPENDENCIES -->
-
-    <!-- Pull in useful test classes from API -->
-    <dependency>
-      <groupId>org.apache.logging.log4j</groupId>
-      <artifactId>log4j-core</artifactId>
-      <type>test-jar</type>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.easymock</groupId>
-      <artifactId>easymock</artifactId>
-      <scope>test</scope>
-    </dependency>
-  </dependencies>
-  <build>
-    <plugins>
-      <!-- Include the standard NOTICE and LICENSE -->
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-remote-resources-plugin</artifactId>
-        <executions>
-          <execution>
-            <goals>
-              <goal>process</goal>
-            </goals>
-            <configuration>
-              <skip>false</skip>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-      <plugin>
-        <groupId>org.apache.felix</groupId>
-        <artifactId>maven-bundle-plugin</artifactId>
-      </plugin>
-    </plugins>
-  </build>
-  <reporting>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-changes-plugin</artifactId>
-        <version>${changes.plugin.version}</version>
-        <reportSets>
-          <reportSet>
-            <reports>
-              <report>changes-report</report>
-            </reports>
-          </reportSet>
-        </reportSets>
-        <configuration>
-          <issueLinkTemplate>%URL%/show_bug.cgi?id=%ISSUE%</issueLinkTemplate>
-        </configuration>
-      </plugin>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-checkstyle-plugin</artifactId>
-        <version>2.7</version>
-        <configuration>
-          <!--<propertiesLocation>${vfs.parent.dir}/checkstyle.properties</propertiesLocation> -->
-          <configLocation>${log4jParentDir}/checkstyle.xml</configLocation>
-          <suppressionsLocation>${log4jParentDir}/checkstyle-suppressions.xml</suppressionsLocation>
-          <enableRulesSummary>false</enableRulesSummary>
-          <propertyExpansion>basedir=${basedir}</propertyExpansion>
-          <propertyExpansion>licensedir=${log4jParentDir}/checkstyle-header.txt</propertyExpansion>
-        </configuration>
-      </plugin>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-javadoc-plugin</artifactId>
-        <version>${javadoc.plugin.version}</version>
-        <configuration>
-          <bottom> <![CDATA[<p align="center">Copyright &#169; {inceptionYear}-{currentYear} {organizationName}. All Rights Reserved.<br />
-            Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo,
-            and the Apache Log4j logo are trademarks of The Apache Software Foundation.</p>]]></bottom>
-          <!-- module link generation is completely broken in the javadoc plugin for a multi-module non-aggregating
-               project -->
-          <detectOfflineLinks>false</detectOfflineLinks>
-          <linksource>true</linksource>
-          <tags>
-            <tag>
-              <name>issue</name>
-              <placement>a</placement>
-              <head>JIRA issue:</head>
-            </tag>
-            <tag>
-              <name>doubt</name>
-              <placement>a</placement>
-              <head>Troublesome:</head>
-            </tag>
-            <tag>
-              <name>compare</name>
-              <placement>a</placement>
-              <head>Compare with:</head>
-            </tag>
-          </tags>
-        </configuration>
-        <reportSets>
-          <reportSet>
-            <id>non-aggregate</id>
-            <reports>
-              <report>javadoc</report>
-            </reports>
-          </reportSet>
-        </reportSets>
-      </plugin>
-      <plugin>
-        <groupId>org.codehaus.mojo</groupId>
-        <artifactId>findbugs-maven-plugin</artifactId>
-        <version>2.5.2</version>
-        <configuration>
-          <fork>true</fork>
-          <jvmArgs>-Duser.language=en</jvmArgs>
-          <threshold>Normal</threshold>
-          <effort>Default</effort>
-          <excludeFilterFile>${log4jParentDir}/findbugs-exclude-filter.xml</excludeFilterFile>
-        </configuration>
-      </plugin>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-jxr-plugin</artifactId>
-        <version>2.3</version>
-        <reportSets>
-          <reportSet>
-            <id>non-aggregate</id>
-            <reports>
-              <report>jxr</report>
-            </reports>
-          </reportSet>
-          <reportSet>
-            <id>aggregate</id>
-            <reports>
-              <report>aggregate</report>
-            </reports>
-          </reportSet>
-        </reportSets>
-      </plugin>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-pmd-plugin</artifactId>
-        <version>${pmd.plugin.version}</version>
-        <configuration>
-          <targetJdk>${maven.compile.target}</targetJdk>
-        </configuration>
-      </plugin>
-      <plugin>
-        <groupId>org.codehaus.mojo</groupId>
-        <artifactId>cobertura-maven-plugin</artifactId>
-        <version>${cobertura.plugin.version}</version>
-        <reportSets>
-          <reportSet>
-            <!-- Disabled as it makes the site build very slow and causes the performance unit test to fail -->
-            <reports />
-          </reportSet>
-        </reportSets>
-      </plugin>
-    </plugins>
-  </reporting>
-</project>
-

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ffc1a38a/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerBufferedInputStream.java
----------------------------------------------------------------------
diff --git a/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerBufferedInputStream.java b/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerBufferedInputStream.java
deleted file mode 100644
index c126dbb..0000000
--- a/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerBufferedInputStream.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.logging.log4j.streams;
-
-import java.io.BufferedInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.nio.charset.Charset;
-
-import org.apache.logging.log4j.Level;
-import org.apache.logging.log4j.Marker;
-import org.apache.logging.log4j.spi.ExtendedLogger;
-
-public class LoggerBufferedInputStream extends BufferedInputStream {
-    private static final String FQCN = LoggerBufferedInputStream.class.getName();
-
-    public LoggerBufferedInputStream(final InputStream in, final Charset charset, final ExtendedLogger logger, final Level level) {
-        this(in, charset, logger, FQCN, level, null);
-    }
-
-    public LoggerBufferedInputStream(final InputStream in, final Charset charset, final ExtendedLogger logger, final Level level, final Marker marker) {
-        this(in, charset, logger, FQCN, level, marker);
-    }
-
-    public LoggerBufferedInputStream(final InputStream in, final Charset charset, final ExtendedLogger logger, final String fqcn, final Level level, final Marker marker) {
-        super(new LoggerInputStream(in, charset, logger, fqcn, level, marker));
-    }
-
-    public LoggerBufferedInputStream(final InputStream in, final Charset charset, final int size, final ExtendedLogger logger, final Level level) {
-        this(in, charset, size, logger, FQCN, level, null);
-    }
-
-    public LoggerBufferedInputStream(final InputStream in, final Charset charset, final int size, final ExtendedLogger logger, final Level level, final Marker marker) {
-        this(in, charset, size, logger, FQCN, level, marker);
-    }
-
-    public LoggerBufferedInputStream(final InputStream in, final Charset charset, final int size, final ExtendedLogger logger, final String fqcn, final Level level, final Marker marker) {
-        super(new LoggerInputStream(in, charset, logger, fqcn, level, marker), size);
-    }
-
-    public LoggerBufferedInputStream(final InputStream in, final ExtendedLogger logger, final Level level) {
-        this(in, logger, FQCN, level, null);
-    }
-
-    public LoggerBufferedInputStream(final InputStream in, final ExtendedLogger logger, final Level level, final Marker marker) {
-        this(in, logger, FQCN, level, marker);
-    }
-
-    public LoggerBufferedInputStream(final InputStream in, final ExtendedLogger logger, final String fqcn, final Level level, final Marker marker) {
-        this(in, Charset.defaultCharset(), logger, fqcn, level, marker);
-    }
-
-    public LoggerBufferedInputStream(final InputStream in, final int size, final ExtendedLogger logger, final Level level) {
-        this(in, size, logger, FQCN, level, null);
-    }
-
-    public LoggerBufferedInputStream(final InputStream in, final int size, final ExtendedLogger logger, final Level level, final Marker marker) {
-        this(in, size, logger, FQCN, level, marker);
-    }
-    
-    public LoggerBufferedInputStream(final InputStream in, final int size, final ExtendedLogger logger, final String fqcn, final Level level, final Marker marker) {
-        this(in, Charset.defaultCharset(), size, logger, fqcn, level, marker);
-    }
-    
-    @Override
-    public void close() throws IOException {
-        super.close();
-    }
-    
-    @Override
-    public synchronized int read() throws IOException {
-        return super.read();
-    }
-    
-    @Override
-    public int read(final byte[] b) throws IOException {
-        return super.read(b, 0, b.length);
-    }
-    
-    @Override
-    public synchronized int read(final byte[] b, final int off, final int len) throws IOException {
-        return super.read(b, off, len);
-    }
-
-    @Override
-    public String toString() {
-        return LoggerBufferedInputStream.class.getSimpleName() + "{stream=" + this.in + '}';
-    }
-}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ffc1a38a/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerBufferedReader.java
----------------------------------------------------------------------
diff --git a/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerBufferedReader.java b/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerBufferedReader.java
deleted file mode 100644
index da770a7..0000000
--- a/log4j-streams/src/main/java/org/apache/logging/log4j/streams/LoggerBufferedReader.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.logging.log4j.streams;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.Reader;
-import java.nio.CharBuffer;
-
-import org.apache.logging.log4j.Level;
-import org.apache.logging.log4j.Marker;
-import org.apache.logging.log4j.spi.ExtendedLogger;
-
-public class LoggerBufferedReader extends BufferedReader {
-    private static final String FQCN = LoggerBufferedReader.class.getName();
-
-    public LoggerBufferedReader(final Reader reader, final ExtendedLogger logger, final Level level) {
-        this(reader, logger, FQCN, level, null);
-    }
-
-    public LoggerBufferedReader(final Reader reader, final ExtendedLogger logger, final Level level, final Marker marker) {
-        this(reader, logger, FQCN, level, marker);
-    }
-
-    public LoggerBufferedReader(final Reader reader, final ExtendedLogger logger, final String fqcn, final Level level, final Marker marker) {
-        super(new LoggerReader(reader, logger, FQCN, level, marker));
-    }
-
-    public LoggerBufferedReader(final Reader reader, final int size, final ExtendedLogger logger, final Level level) {
-        this(reader, size, logger, FQCN, level, null);
-    }
-
-    public LoggerBufferedReader(final Reader reader, final int size, final ExtendedLogger logger, final Level level, final Marker marker) {
-        this(reader, size, logger, FQCN, level, marker);
-    }
-
-    public LoggerBufferedReader(final Reader reader, final int size, final ExtendedLogger logger, final String fqcn, final Level level, final Marker marker) {
-        super(new LoggerReader(reader, logger, FQCN, level, marker), size);
-    }
-    
-    @Override
-    public void close() throws IOException {
-        super.close();
-    }
-    
-    @Override
-    public int read() throws IOException {
-        return super.read();
-    }
-    
-    @Override
-    public int read(final char[] cbuf) throws IOException {
-        return super.read(cbuf, 0, cbuf.length);
-    }
-    
-    @Override
-    public int read(final char[] cbuf, final int off, final int len) throws IOException {
-        return super.read(cbuf, off, len);
-    }
-    
-    @Override
-    public int read(final CharBuffer target) throws IOException {
-        final int len = target.remaining();
-        final char[] cbuf = new char[len];
-        final int charsRead = read(cbuf, 0, len);
-        if (charsRead > 0) {
-            target.put(cbuf, 0, charsRead);
-        }
-        return charsRead;
-    }
-    
-    @Override
-    public String readLine() throws IOException {
-        return super.readLine();
-    }
-}


[5/6] git commit: Fold down util package.

Posted by ma...@apache.org.
Fold down util package.


Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/e8d75eee
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/e8d75eee
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/e8d75eee

Branch: refs/heads/master
Commit: e8d75eeece5ae2f490a13c05ded532a99d17d62d
Parents: ffc1a38
Author: Matt Sicker <ma...@apache.org>
Authored: Wed Sep 3 00:21:54 2014 -0500
Committer: Matt Sicker <ma...@apache.org>
Committed: Wed Sep 3 00:21:54 2014 -0500

----------------------------------------------------------------------
 .../logging/log4j/io/ByteStreamLogger.java      | 152 +++++++++++++++++++
 .../logging/log4j/io/CharStreamLogger.java      | 110 ++++++++++++++
 .../log4j/io/LoggerFilterOutputStream.java      |   1 -
 .../logging/log4j/io/LoggerFilterWriter.java    |   1 -
 .../logging/log4j/io/LoggerInputStream.java     |   1 -
 .../logging/log4j/io/LoggerOutputStream.java    |   1 -
 .../apache/logging/log4j/io/LoggerReader.java   |   1 -
 .../apache/logging/log4j/io/LoggerWriter.java   |   1 -
 .../logging/log4j/io/util/ByteStreamLogger.java | 152 -------------------
 .../logging/log4j/io/util/CharStreamLogger.java | 110 --------------
 10 files changed, 262 insertions(+), 268 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/e8d75eee/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/ByteStreamLogger.java
----------------------------------------------------------------------
diff --git a/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/ByteStreamLogger.java b/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/ByteStreamLogger.java
new file mode 100644
index 0000000..42c4c63
--- /dev/null
+++ b/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/ByteStreamLogger.java
@@ -0,0 +1,152 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.logging.log4j.io;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.nio.ByteBuffer;
+import java.nio.charset.Charset;
+
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.Marker;
+import org.apache.logging.log4j.spi.ExtendedLogger;
+
+public class ByteStreamLogger {
+    private class ByteBufferInputStream extends InputStream {
+
+        @Override
+        public int read() throws IOException {
+            ByteStreamLogger.this.buf.flip();
+            int result = -1;
+            if (ByteStreamLogger.this.buf.limit() > 0) {
+                result = ByteStreamLogger.this.buf.get() & 0xFF;
+            }
+            ByteStreamLogger.this.buf.compact();
+            return result;
+        }
+
+        @Override
+        public int read(final byte[] bytes, final int off, final int len) throws IOException {
+            ByteStreamLogger.this.buf.flip();
+            int result = -1;
+            if (ByteStreamLogger.this.buf.limit() > 0) {
+                result = Math.min(len, ByteStreamLogger.this.buf.limit());
+                ByteStreamLogger.this.buf.get(bytes, off, result);
+            }
+            ByteStreamLogger.this.buf.compact();
+            return result;
+        }
+    }
+
+    private static final int BUFFER_SIZE = 1024;
+    private final ExtendedLogger logger;
+    private final Level level;
+    private final Marker marker;
+    private final ByteBufferInputStream inputStream;
+    private final InputStreamReader reader;
+    private final char[] msgBuf = new char[BUFFER_SIZE];
+    private final StringBuilder msg = new StringBuilder();
+    private boolean closed;
+
+    private final ByteBuffer buf = ByteBuffer.allocate(BUFFER_SIZE);
+
+    public ByteStreamLogger(final ExtendedLogger logger, final Level level, final Marker marker, final Charset charset) {
+        this.logger = logger;
+        this.level = level;
+        this.marker = marker;
+        this.inputStream = new ByteBufferInputStream();
+        this.reader = new InputStreamReader(this.inputStream, charset);
+    }
+
+    public void close(final String fqcn) {
+        synchronized (this.msg) {
+            this.closed = true;
+            logEnd(fqcn);
+//            in.close();
+        }
+    }
+
+    private void extractMessages(final String fqcn) throws IOException {
+        if (this.closed) {
+            return;
+        }
+        int read = this.reader.read(this.msgBuf);
+        while (read > 0) {
+            int off = 0;
+            for (int pos = 0; pos < read; pos++) {
+                switch (this.msgBuf[pos]) {
+                case '\r':
+                    this.msg.append(this.msgBuf, off, pos - off);
+                    off = pos + 1;
+                    break;
+                case '\n':
+                    this.msg.append(this.msgBuf, off, pos - off);
+                    off = pos + 1;
+                    log(fqcn);
+                    break;
+                }
+            }
+            this.msg.append(this.msgBuf, off, read - off);
+            read = this.reader.read(this.msgBuf);
+        }
+    }
+
+    private void log(final String fqcn) {
+        // convert to string now so async loggers work
+        this.logger.logIfEnabled(fqcn, this.level, this.marker, this.msg.toString());
+        this.msg.setLength(0);
+    }
+    
+    private void logEnd(final String fqcn) {
+        if (this.msg.length() > 0) {
+            log(fqcn);
+        }
+    }
+
+    public void put(final String fqcn, final byte[] b, final int off, final int len) throws IOException {
+        int curOff = off;
+        int curLen = len;
+        if (curLen >= 0) {
+            synchronized (this.msg) {
+                while (curLen > this.buf.remaining()) {
+                    final int remaining = this.buf.remaining();
+                    this.buf.put(b, curOff, remaining);
+                    curLen -= remaining;
+                    curOff += remaining;
+                    extractMessages(fqcn);
+                }
+                this.buf.put(b, curOff, curLen);
+                extractMessages(fqcn);
+            }
+        } else {
+            logEnd(fqcn);
+        }
+    }
+
+    public void put(final String fqcn, final int b) throws IOException {
+        if (b >= 0) {
+            synchronized (this.msg) {
+                this.buf.put((byte) (b & 0xFF));
+                extractMessages(fqcn);
+            }
+        } else {
+            logEnd(fqcn);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/e8d75eee/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/CharStreamLogger.java
----------------------------------------------------------------------
diff --git a/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/CharStreamLogger.java b/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/CharStreamLogger.java
new file mode 100644
index 0000000..f3977d8
--- /dev/null
+++ b/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/CharStreamLogger.java
@@ -0,0 +1,110 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.logging.log4j.io;
+
+import java.nio.CharBuffer;
+
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.Marker;
+import org.apache.logging.log4j.spi.ExtendedLogger;
+
+public class CharStreamLogger {
+    private final ExtendedLogger logger;
+    private final Level level;
+    private final Marker marker;
+    private final StringBuilder msg = new StringBuilder();
+    private boolean closed = false;
+
+    public CharStreamLogger(final ExtendedLogger logger, final Level level, final Marker marker) {
+        this.logger = logger;
+        this.level = level;
+        this.marker = marker;
+    }
+
+    public void close(final String fqcn) {
+        synchronized (this.msg) {
+            this.closed = true;
+            logEnd(fqcn);
+        }
+    }
+
+    private void log(final String fqcn) {
+        // convert to string now so async loggers work
+        this.logger.logIfEnabled(fqcn, this.level, this.marker, this.msg.toString());
+        this.msg.setLength(0);
+    }
+
+    private void logEnd(final String fqcn) {
+        if (this.msg.length() > 0) {
+            log(fqcn);
+        }
+    }
+
+    public void put(final String fqcn, final char[] cbuf, final int off, final int len) {
+        put(fqcn, CharBuffer.wrap(cbuf), off, len);
+    }
+
+    public void put(final String fqcn, final CharSequence str, final int off, final int len) {
+        if (len >= 0) {
+            synchronized (this.msg) {
+                if (this.closed) {
+                    return;
+                }
+                int start = off;
+                final int end = off + len;
+                for (int pos = off; pos < end; pos++) {
+                    final char c = str.charAt(pos);
+                    switch (c) {
+                    case '\r':
+                    case '\n':
+                        this.msg.append(str, start, pos);
+                        start = pos + 1;
+                        if (c == '\n') {
+                            log(fqcn);
+                        }
+                        break;
+                    }
+                }
+                this.msg.append(str, start, end);
+            }
+        } else {
+            logEnd(fqcn);
+        }
+    }
+
+    public void put(final String fqcn, final int c) {
+        if (c >= 0) {
+            synchronized (this.msg) {
+                if (this.closed) {
+                    return;
+                }
+                switch (c) {
+                case '\n':
+                    log(fqcn);
+                    break;
+                case '\r':
+                    break;
+                default:
+                    this.msg.append((char) c);
+                }
+            }
+        } else {
+            logEnd(fqcn);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/e8d75eee/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/LoggerFilterOutputStream.java
----------------------------------------------------------------------
diff --git a/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/LoggerFilterOutputStream.java b/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/LoggerFilterOutputStream.java
index b9e6d78..d17544c 100644
--- a/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/LoggerFilterOutputStream.java
+++ b/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/LoggerFilterOutputStream.java
@@ -25,7 +25,6 @@ import java.nio.charset.Charset;
 import org.apache.logging.log4j.Level;
 import org.apache.logging.log4j.Marker;
 import org.apache.logging.log4j.spi.ExtendedLogger;
-import org.apache.logging.log4j.io.util.ByteStreamLogger;
 
 /**
  * Logs each line written to a pre-defined level. Can also be configured with a Marker. This class provides an interface

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/e8d75eee/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/LoggerFilterWriter.java
----------------------------------------------------------------------
diff --git a/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/LoggerFilterWriter.java b/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/LoggerFilterWriter.java
index a700f92..5a9d8e0 100644
--- a/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/LoggerFilterWriter.java
+++ b/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/LoggerFilterWriter.java
@@ -24,7 +24,6 @@ import java.io.Writer;
 import org.apache.logging.log4j.Level;
 import org.apache.logging.log4j.Marker;
 import org.apache.logging.log4j.spi.ExtendedLogger;
-import org.apache.logging.log4j.io.util.CharStreamLogger;
 
 /**
  * Logs each line written to a pre-defined level. Can also be configured with a Marker. This class provides an interface

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/e8d75eee/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/LoggerInputStream.java
----------------------------------------------------------------------
diff --git a/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/LoggerInputStream.java b/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/LoggerInputStream.java
index 873723f..445e366 100644
--- a/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/LoggerInputStream.java
+++ b/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/LoggerInputStream.java
@@ -25,7 +25,6 @@ import java.nio.charset.Charset;
 import org.apache.logging.log4j.Level;
 import org.apache.logging.log4j.Marker;
 import org.apache.logging.log4j.spi.ExtendedLogger;
-import org.apache.logging.log4j.io.util.ByteStreamLogger;
 
 /**
  * Logs each line read to a pre-defined level. Can also be configured with a Marker.

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/e8d75eee/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/LoggerOutputStream.java
----------------------------------------------------------------------
diff --git a/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/LoggerOutputStream.java b/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/LoggerOutputStream.java
index f0ab698..0d1829b 100644
--- a/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/LoggerOutputStream.java
+++ b/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/LoggerOutputStream.java
@@ -24,7 +24,6 @@ import java.nio.charset.Charset;
 import org.apache.logging.log4j.Level;
 import org.apache.logging.log4j.Marker;
 import org.apache.logging.log4j.spi.ExtendedLogger;
-import org.apache.logging.log4j.io.util.ByteStreamLogger;
 
 /**
  * Logs each line written to a pre-defined level. Can also be configured with a Marker. This class provides an interface

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/e8d75eee/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/LoggerReader.java
----------------------------------------------------------------------
diff --git a/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/LoggerReader.java b/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/LoggerReader.java
index 658a988..48427f8 100644
--- a/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/LoggerReader.java
+++ b/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/LoggerReader.java
@@ -25,7 +25,6 @@ import java.nio.CharBuffer;
 import org.apache.logging.log4j.Level;
 import org.apache.logging.log4j.Marker;
 import org.apache.logging.log4j.spi.ExtendedLogger;
-import org.apache.logging.log4j.io.util.CharStreamLogger;
 
 /**
  * Logs each line written to a pre-defined level. Can also be configured with a Marker. This class provides an interface

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/e8d75eee/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/LoggerWriter.java
----------------------------------------------------------------------
diff --git a/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/LoggerWriter.java b/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/LoggerWriter.java
index 70118e8..70310ad 100644
--- a/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/LoggerWriter.java
+++ b/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/LoggerWriter.java
@@ -23,7 +23,6 @@ import java.io.Writer;
 import org.apache.logging.log4j.Level;
 import org.apache.logging.log4j.Marker;
 import org.apache.logging.log4j.spi.ExtendedLogger;
-import org.apache.logging.log4j.io.util.CharStreamLogger;
 
 /**
  * Logs each line written to a pre-defined level. Can also be configured with a Marker. This class provides an interface

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/e8d75eee/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/util/ByteStreamLogger.java
----------------------------------------------------------------------
diff --git a/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/util/ByteStreamLogger.java b/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/util/ByteStreamLogger.java
deleted file mode 100644
index bbba82e..0000000
--- a/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/util/ByteStreamLogger.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.logging.log4j.io.util;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.nio.ByteBuffer;
-import java.nio.charset.Charset;
-
-import org.apache.logging.log4j.Level;
-import org.apache.logging.log4j.Marker;
-import org.apache.logging.log4j.spi.ExtendedLogger;
-
-public class ByteStreamLogger {
-    private class ByteBufferInputStream extends InputStream {
-
-        @Override
-        public int read() throws IOException {
-            ByteStreamLogger.this.buf.flip();
-            int result = -1;
-            if (ByteStreamLogger.this.buf.limit() > 0) {
-                result = ByteStreamLogger.this.buf.get() & 0xFF;
-            }
-            ByteStreamLogger.this.buf.compact();
-            return result;
-        }
-
-        @Override
-        public int read(final byte[] bytes, final int off, final int len) throws IOException {
-            ByteStreamLogger.this.buf.flip();
-            int result = -1;
-            if (ByteStreamLogger.this.buf.limit() > 0) {
-                result = Math.min(len, ByteStreamLogger.this.buf.limit());
-                ByteStreamLogger.this.buf.get(bytes, off, result);
-            }
-            ByteStreamLogger.this.buf.compact();
-            return result;
-        }
-    }
-
-    private static final int BUFFER_SIZE = 1024;
-    private final ExtendedLogger logger;
-    private final Level level;
-    private final Marker marker;
-    private final ByteBufferInputStream inputStream;
-    private final InputStreamReader reader;
-    private final char[] msgBuf = new char[BUFFER_SIZE];
-    private final StringBuilder msg = new StringBuilder();
-    private boolean closed;
-
-    private final ByteBuffer buf = ByteBuffer.allocate(BUFFER_SIZE);
-
-    public ByteStreamLogger(final ExtendedLogger logger, final Level level, final Marker marker, final Charset charset) {
-        this.logger = logger;
-        this.level = level;
-        this.marker = marker;
-        this.inputStream = new ByteBufferInputStream();
-        this.reader = new InputStreamReader(this.inputStream, charset);
-    }
-
-    public void close(final String fqcn) {
-        synchronized (this.msg) {
-            this.closed = true;
-            logEnd(fqcn);
-//            in.close();
-        }
-    }
-
-    private void extractMessages(final String fqcn) throws IOException {
-        if (this.closed) {
-            return;
-        }
-        int read = this.reader.read(this.msgBuf);
-        while (read > 0) {
-            int off = 0;
-            for (int pos = 0; pos < read; pos++) {
-                switch (this.msgBuf[pos]) {
-                case '\r':
-                    this.msg.append(this.msgBuf, off, pos - off);
-                    off = pos + 1;
-                    break;
-                case '\n':
-                    this.msg.append(this.msgBuf, off, pos - off);
-                    off = pos + 1;
-                    log(fqcn);
-                    break;
-                }
-            }
-            this.msg.append(this.msgBuf, off, read - off);
-            read = this.reader.read(this.msgBuf);
-        }
-    }
-
-    private void log(final String fqcn) {
-        // convert to string now so async loggers work
-        this.logger.logIfEnabled(fqcn, this.level, this.marker, this.msg.toString());
-        this.msg.setLength(0);
-    }
-    
-    private void logEnd(final String fqcn) {
-        if (this.msg.length() > 0) {
-            log(fqcn);
-        }
-    }
-
-    public void put(final String fqcn, final byte[] b, final int off, final int len) throws IOException {
-        int curOff = off;
-        int curLen = len;
-        if (curLen >= 0) {
-            synchronized (this.msg) {
-                while (curLen > this.buf.remaining()) {
-                    final int remaining = this.buf.remaining();
-                    this.buf.put(b, curOff, remaining);
-                    curLen -= remaining;
-                    curOff += remaining;
-                    extractMessages(fqcn);
-                }
-                this.buf.put(b, curOff, curLen);
-                extractMessages(fqcn);
-            }
-        } else {
-            logEnd(fqcn);
-        }
-    }
-
-    public void put(final String fqcn, final int b) throws IOException {
-        if (b >= 0) {
-            synchronized (this.msg) {
-                this.buf.put((byte) (b & 0xFF));
-                extractMessages(fqcn);
-            }
-        } else {
-            logEnd(fqcn);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/e8d75eee/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/util/CharStreamLogger.java
----------------------------------------------------------------------
diff --git a/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/util/CharStreamLogger.java b/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/util/CharStreamLogger.java
deleted file mode 100644
index 6107796..0000000
--- a/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/util/CharStreamLogger.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.logging.log4j.io.util;
-
-import java.nio.CharBuffer;
-
-import org.apache.logging.log4j.Level;
-import org.apache.logging.log4j.Marker;
-import org.apache.logging.log4j.spi.ExtendedLogger;
-
-public class CharStreamLogger {
-    private final ExtendedLogger logger;
-    private final Level level;
-    private final Marker marker;
-    private final StringBuilder msg = new StringBuilder();
-    private boolean closed = false;
-
-    public CharStreamLogger(final ExtendedLogger logger, final Level level, final Marker marker) {
-        this.logger = logger;
-        this.level = level;
-        this.marker = marker;
-    }
-
-    public void close(final String fqcn) {
-        synchronized (this.msg) {
-            this.closed = true;
-            logEnd(fqcn);
-        }
-    }
-
-    private void log(final String fqcn) {
-        // convert to string now so async loggers work
-        this.logger.logIfEnabled(fqcn, this.level, this.marker, this.msg.toString());
-        this.msg.setLength(0);
-    }
-
-    private void logEnd(final String fqcn) {
-        if (this.msg.length() > 0) {
-            log(fqcn);
-        }
-    }
-
-    public void put(final String fqcn, final char[] cbuf, final int off, final int len) {
-        put(fqcn, CharBuffer.wrap(cbuf), off, len);
-    }
-
-    public void put(final String fqcn, final CharSequence str, final int off, final int len) {
-        if (len >= 0) {
-            synchronized (this.msg) {
-                if (this.closed) {
-                    return;
-                }
-                int start = off;
-                final int end = off + len;
-                for (int pos = off; pos < end; pos++) {
-                    final char c = str.charAt(pos);
-                    switch (c) {
-                    case '\r':
-                    case '\n':
-                        this.msg.append(str, start, pos);
-                        start = pos + 1;
-                        if (c == '\n') {
-                            log(fqcn);
-                        }
-                        break;
-                    }
-                }
-                this.msg.append(str, start, end);
-            }
-        } else {
-            logEnd(fqcn);
-        }
-    }
-
-    public void put(final String fqcn, final int c) {
-        if (c >= 0) {
-            synchronized (this.msg) {
-                if (this.closed) {
-                    return;
-                }
-                switch (c) {
-                case '\n':
-                    log(fqcn);
-                    break;
-                case '\r':
-                    break;
-                default:
-                    this.msg.append((char) c);
-                }
-            }
-        } else {
-            logEnd(fqcn);
-        }
-    }
-}


[6/6] git commit: Merge remote-tracking branch 'refs/remotes/origin/master'

Posted by ma...@apache.org.
Merge remote-tracking branch 'refs/remotes/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/b5bc4385
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/b5bc4385
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/b5bc4385

Branch: refs/heads/master
Commit: b5bc43857dd2c086cdd8553270b6463fdc8f3eda
Parents: e8d75ee 49aaf52
Author: Matt Sicker <ma...@apache.org>
Authored: Wed Sep 3 00:23:35 2014 -0500
Committer: Matt Sicker <ma...@apache.org>
Committed: Wed Sep 3 00:23:35 2014 -0500

----------------------------------------------------------------------

----------------------------------------------------------------------