Package org.apache.log.output.io
Class WriterTarget
- java.lang.Object
-
- org.apache.log.output.AbstractTarget
-
- org.apache.log.output.AbstractOutputTarget
-
- org.apache.log.output.io.WriterTarget
-
- All Implemented Interfaces:
ErrorAware
,LogTarget
,Closeable
public class WriterTarget extends AbstractOutputTarget
This target outputs to a writer.- Author:
- Peter Donald
-
-
Field Summary
Fields Modifier and Type Field Description private java.io.Writer
m_output
-
Constructor Summary
Constructors Constructor Description WriterTarget(java.io.Writer writer, Formatter formatter)
Construct target with a specific writer and formatter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Shutdown target.protected void
setWriter(java.io.Writer writer)
Set the writer.protected void
shutdownWriter()
Shutdown Writer.protected void
write(java.lang.String data)
Concrete implementation of output that writes out to underlying writer.-
Methods inherited from class org.apache.log.output.AbstractOutputTarget
doProcessEvent, getFormatter, open
-
Methods inherited from class org.apache.log.output.AbstractTarget
getErrorHandler, isOpen, processEvent, setErrorHandler
-
-
-
-
Constructor Detail
-
WriterTarget
public WriterTarget(java.io.Writer writer, Formatter formatter)
Construct target with a specific writer and formatter.- Parameters:
writer
- the writerformatter
- the formatter
-
-
Method Detail
-
setWriter
protected void setWriter(java.io.Writer writer)
Set the writer. Close down writer and write tail if appropriate.- Parameters:
writer
- the new writer
-
write
protected void write(java.lang.String data)
Concrete implementation of output that writes out to underlying writer.- Overrides:
write
in classAbstractOutputTarget
- Parameters:
data
- the data to output
-
close
public void close()
Shutdown target. Attempting to write to target after close() will cause errors to be logged.- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classAbstractOutputTarget
-
shutdownWriter
protected void shutdownWriter()
Shutdown Writer.
-
-