AutoCloseable
public class WriterManager extends AbstractManager
Modifier and Type | Field | Description |
---|---|---|
protected StringLayout |
layout |
count, LOGGER
Constructor | Description |
---|---|
WriterManager(Writer writer,
String streamName,
StringLayout layout,
boolean writeHeader) |
Modifier and Type | Method | Description |
---|---|---|
protected void |
closeWriter() |
|
void |
flush() |
Flushes any buffers.
|
static <T> WriterManager |
getManager(String name,
T data,
ManagerFactory<? extends WriterManager,T> factory) |
Creates a Manager.
|
protected Writer |
getWriter() |
|
boolean |
isOpen() |
Returns the status of the stream.
|
boolean |
releaseSub(long timeout,
TimeUnit timeUnit) |
Default hook to write footer during close.
|
protected void |
setWriter(Writer writer) |
|
protected void |
write(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
public WriterManager(Writer writer, String streamName, StringLayout layout, boolean writeHeader)
public static <T> WriterManager getManager(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 Writer getWriter()
public boolean isOpen()
public boolean releaseSub(long timeout, TimeUnit timeUnit)
releaseSub
in class AbstractManager
timeout
- timeouttimeUnit
- timeout time unitprotected void setWriter(Writer writer)
protected void write(String str)
str
- the string to writeAppenderLoggingException
- if an error occurs.protected void writeFooter()
Copyright © 1999-2018. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.