org.apache.log.output.io
Class StreamTarget
- Closeable, ErrorAware, LogTarget
public class StreamTarget
A basic target that writes to an OutputStream.
- Peter Donald
StreamTarget(OutputStream outputStream, Formatter formatter) - Constructor that writes to a stream and uses a particular formatter.
|
StreamTarget(OutputStream outputStream, Formatter formatter, String encoding) - Constructor that writes to a stream and uses a particular formatter.
|
void | close() - Shutdown target.
|
protected void | setOutputStream(OutputStream outputStream) - Set the output stream.
|
protected void | shutdownStream() - Shutdown output stream.
|
protected void | write(String data) - Abstract method that will output event.
|
StreamTarget
public StreamTarget(OutputStream outputStream,
Formatter formatter)
Constructor that writes to a stream and uses a particular formatter.
outputStream
- the OutputStream to write toformatter
- the Formatter to use
StreamTarget
public StreamTarget(OutputStream outputStream,
Formatter formatter,
String encoding)
Constructor that writes to a stream and uses a particular formatter.
outputStream
- the OutputStream to write toformatter
- the Formatter to useencoding
- Desired encoding to use when writing to the log, null
implies the default system encoding.
close
public void close()
Shutdown target.
Attempting to write to target after close() will cause errors to be logged.
- close in interface Closeable
- close in interface AbstractOutputTarget
setOutputStream
protected void setOutputStream(OutputStream outputStream)
Set the output stream.
Close down old stream and write tail if appropriate.
outputStream
- the new OutputStream
shutdownStream
protected void shutdownStream()
Shutdown output stream.
write
protected void write(String data)
Abstract method that will output event.
- write in interface AbstractOutputTarget
data
- the data to be output