org.apache.log.output.io

Class WriterTarget

Implemented Interfaces:
ErrorAware, LogTarget
Known Direct Subclasses:
DefaultOutputLogTarget

public class WriterTarget
extends AbstractOutputTarget

This target outputs to a writer.
Author:
Peter Donald

Field Summary

protected Writer
m_output
Deprecated. Accessing this variable in subclasses is no longer supported and will become private in the future.

Fields inherited from class org.apache.log.output.AbstractOutputTarget

m_formatter

Constructor Summary

WriterTarget(Writer writer, Formatter formatter)
Construct target with a specific writer and formatter.

Method Summary

void
close()
Shutdown target.
protected void
setWriter(Writer writer)
Set the writer.
protected void
shutdownWriter()
Shutdown Writer.
protected void
write(String data)
Concrete implementation of output that writes out to underlying writer.

Methods inherited from class org.apache.log.output.AbstractOutputTarget

close, doProcessEvent, getFormatter, open, output, setFormatter, write

Methods inherited from class org.apache.log.output.AbstractTarget

close, doProcessEvent, error, getErrorHandler, isOpen, open, processEvent, setErrorHandler

Field Details

m_output

protected Writer m_output

Deprecated. Accessing this variable in subclasses is no longer supported and will become private in the future.

Constructor Details

WriterTarget

public WriterTarget(Writer writer,
                    Formatter formatter)
Construct target with a specific writer and formatter.
Parameters:
writer - the writer
formatter - the formatter

Method Details

close

public void close()
Shutdown target. Attempting to write to target after close() will cause errors to be logged.
Overrides:
close in interface AbstractOutputTarget

setWriter

protected void setWriter(Writer writer)
Set the writer. Close down writer and write tail if appropriate.
Parameters:
writer - the new writer

shutdownWriter

protected void shutdownWriter()
Shutdown Writer.

write

protected void write(String data)
Concrete implementation of output that writes out to underlying writer.
Overrides:
write in interface AbstractOutputTarget
Parameters:
data - the data to output