[ 
https://issues.apache.org/jira/browse/LOG4J2-481?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13870033#comment-13870033
 ] 

Remko Popma commented on LOG4J2-481:
------------------------------------

Matt, Ralph, one more thing:
I am not sure that the current code in LoggerStream$HelperStream correctly 
handles {{'\r'}} (that are not followed by {{'\n'}}) characters. Is that not a 
use case we need to defend against?
{code}
@Override
public synchronized void write(int b) {
    if (b == '\r') {
        return;
    }
    super.write(b);
    if (b == '\n') {
        log(count - 1);
    }
}

@Override
public synchronized void write(byte[] b, int off, int len) {
    for (int i = 0; i < len; ++i) {
        write(b[off + i]);
    }
}
{code}

> Stream-Interface for Loggers
> ----------------------------
>
>                 Key: LOG4J2-481
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-481
>             Project: Log4j 2
>          Issue Type: New Feature
>          Components: API
>    Affects Versions: 2.0-beta9
>         Environment: Linux, Java 1.7
>            Reporter: Joe Merten
>             Fix For: 2.0-rc1
>
>         Attachments: 0001-Add-LoggerStream-and-tests.patch, 
> 0001-Remove-dead-code.patch
>
>
> I would like to have method (or class) to use a logger as a PrintStream, like 
> e.g.:
> {quote}
> PrintStream Logger.getStream(Level level);
> {quote}
> or maybe like this 
> http://www.java2s.com/Open-Source/Java/Testing/jacareto/jacareto/toolkit/log4j/LogOutputStream.java.htm
> (as I recently discovered, org.apache.commons.exec.LogOutputStream is doing 
> different things).



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to