You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by Ceki Gülcü <ce...@qos.ch> on 2002/01/11 17:16:49 UTC

Re: The Plan [Was: [POLL] Commercial documentation]

At 14:55 10.01.2002 -0800, Kevin Steppe wrote:

>What do you see as the current status of things?  What needs work now, and what is in the pipeline?  What does 1.2 need to go beta and then as a stable release?
>
>Regards,
>Kevin

Kevin,

A rough draft of the work plan is available at

  http://jakarta.apache.org/log4j/docs/plan.html  

Preparing a detailed work plan is not easy. I'll work on it some
more to make it more useful. Have a nice weekend, Ceki

ps: I won't have access to a computer this coming weekend.




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Log4jOutputStream

Posted by ba...@generationjava.com.
I'm sure this kind of class has come up before, but I thought I'd mention
it, and it's obvious partners of Log4jWriter, Log4jReader and
Log4jInputStream. I wrote it as a simple example of how Log4j can be
useful and figured I might as well send it to the list.

Another option is to use a TeeOutputStream and write an
OutputStreamRenderer. But the TeeOutputStream would have to take a
Category argument and then it would no longer be a normal TeeOutputStream.

Bay
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

package com.generationjava.log4j;

import java.io.ByteArrayOutputStream;
import java.io.FilterOutputStream;
import java.io.IOException;
import java.io.OutputStream;

import org.apache.log4j.Category;

// snoop an outputstream
public class Log4jOutputStream extends FilterOutputStream {

    private Category logger;
    private int bufferChar;  // make this settable
    private ByteArrayOutputStream baos;

    public Log4jOutputStream(Category logger, OutputStream proxy) {
        super(proxy);
        this.logger = logger;
        this.baos = new ByteArrayOutputStream();
        this.bufferChar = (int)'\n';
    }

    public void write(int val) throws IOException {
        baos.write(val);
        if(val == this.bufferChar) {
            logger.debug(baos.toString());
            baos.reset();
        }
        super.write(val);
    }

    public void flush() throws IOException {
        logger.debug(baos.toString());
        baos.reset();
        super.flush();
    }

}



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>