public class WriterManager extends AbstractManager
Modifier and Type | Field and Description |
---|---|
protected StringLayout |
layout |
private java.io.Writer |
writer |
count, LOGGER
Constructor and Description |
---|
WriterManager(java.io.Writer writer,
java.lang.String streamName,
StringLayout layout,
boolean writeHeader) |
Modifier and Type | Method and Description |
---|---|
protected void |
closeWriter() |
void |
flush()
Flushes any buffers.
|
static <T> WriterManager |
getManager(java.lang.String name,
T data,
ManagerFactory<? extends WriterManager,T> factory)
Creates a Manager.
|
protected java.io.Writer |
getWriter() |
boolean |
isOpen()
Returns the status of the stream.
|
boolean |
releaseSub(long timeout,
java.util.concurrent.TimeUnit timeUnit)
Default hook to write footer during close.
|
protected void |
setWriter(java.io.Writer writer) |
protected void |
write(java.lang.String str)
Some output streams synchronize writes while others do not.
|
protected void |
writeFooter()
Writes the footer.
|
close, getContentFormat, getCount, getLoggerContext, getName, hasManager, log, logDebug, logError, logWarn, narrow, release, stop, updateData
protected final StringLayout layout
private volatile java.io.Writer writer
public WriterManager(java.io.Writer writer, java.lang.String streamName, StringLayout layout, boolean writeHeader)
public static <T> WriterManager getManager(java.lang.String name, T data, ManagerFactory<? extends WriterManager,T> factory)
T
- The type of the WriterManager.name
- The name of the stream to manage.data
- The data to pass to the Manager.factory
- The factory to use to create the Manager.protected void closeWriter()
public void flush()
protected java.io.Writer getWriter()
public boolean isOpen()
public boolean releaseSub(long timeout, java.util.concurrent.TimeUnit timeUnit)
releaseSub
in class AbstractManager
timeout
- timeouttimeUnit
- timeout time unitprotected void setWriter(java.io.Writer writer)
protected void write(java.lang.String str)
str
- the string to writeAppenderLoggingException
- if an error occurs.protected void writeFooter()