org.apache.log.output.io

Class StreamTarget

public class StreamTarget extends AbstractOutputTarget

A basic target that writes to an OutputStream.

Author: Peter Donald

Constructor Summary
StreamTarget(OutputStream outputStream, Formatter formatter)
Constructor that writes to a stream and uses a particular formatter.
Method Summary
voidclose()
Shutdown target.
protected voidsetOutputStream(OutputStream outputStream)
Set the output stream.
protected voidshutdownStream()
Shutdown output stream.
protected voidwrite(String data)
Abstract method that will output event.

Constructor Detail

StreamTarget

public StreamTarget(OutputStream outputStream, Formatter formatter)
Constructor that writes to a stream and uses a particular formatter.

Parameters: outputStream the OutputStream to write to formatter the Formatter to use

Method Detail

close

public void close()
Shutdown target. Attempting to write to target after close() will cause errors to be logged.

setOutputStream

protected void setOutputStream(OutputStream outputStream)
Set the output stream. Close down old stream and write tail if appropriate.

Parameters: outputStream the new OutputStream

shutdownStream

protected void shutdownStream()
Shutdown output stream.

write

protected void write(String data)
Abstract method that will output event.

Parameters: data the data to be output