public class FileManager extends OutputStreamManager
byteBuffer, layout
count, LOGGER
Modifier | Constructor and Description |
---|---|
protected |
FileManager(String fileName,
OutputStream os,
boolean append,
boolean locking,
String advertiseURI,
Layout<? extends Serializable> layout,
boolean writeHeader,
ByteBuffer buffer) |
protected |
FileManager(String fileName,
OutputStream os,
boolean append,
boolean locking,
String advertiseURI,
Layout<? extends Serializable> layout,
int bufferSize,
boolean writeHeader)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
int |
getBufferSize()
Returns the buffer size to use if the appender was configured with BufferedIO=true, otherwise returns a negative
number.
|
Map<String,String> |
getContentFormat()
FileManager's content format is specified by:
Key: "fileURI" Value: provided "advertiseURI" param . |
static FileManager |
getFileManager(String fileName,
boolean append,
boolean locking,
boolean bufferedIo,
String advertiseUri,
Layout<? extends Serializable> layout,
int bufferSize,
boolean immediateFlush)
Returns the FileManager.
|
String |
getFileName()
Returns the name of the File being managed.
|
boolean |
isAppend()
Returns the append status.
|
boolean |
isLocking()
Returns the lock status.
|
protected void |
write(byte[] bytes,
int offset,
int length,
boolean immediateFlush)
Some output streams synchronize writes while others do not.
|
close, drain, flush, flushBuffer, flushDestination, getByteBuffer, getManager, getOutputStream, isOpen, releaseSub, setOutputStream, skipFooter, write, write, write, writeFooter, writeToDestination
getCount, getName, hasManager, log, logDebug, logError, logWarn, release, updateData
@Deprecated protected FileManager(String fileName, OutputStream os, boolean append, boolean locking, String advertiseURI, Layout<? extends Serializable> layout, int bufferSize, boolean writeHeader)
protected FileManager(String fileName, OutputStream os, boolean append, boolean locking, String advertiseURI, Layout<? extends Serializable> layout, boolean writeHeader, ByteBuffer buffer)
public static FileManager getFileManager(String fileName, boolean append, boolean locking, boolean bufferedIo, String advertiseUri, Layout<? extends Serializable> layout, int bufferSize, boolean immediateFlush)
fileName
- The name of the file to manage.append
- true if the file should be appended to, false if it should be overwritten.locking
- true if the file should be locked while writing, false otherwise.bufferedIo
- true if the contents should be buffered as they are written.advertiseUri
- the URI to use when advertising the filelayout
- The layoutbufferSize
- buffer size for buffered IOimmediateFlush
- true if the contents should be flushed on every write, false otherwise.protected void write(byte[] bytes, int offset, int length, boolean immediateFlush)
OutputStreamManager
write
in class OutputStreamManager
bytes
- The serialized Log event.offset
- The offset into the byte array.length
- The number of bytes to write.immediateFlush
- flushes immediately after writing.public String getFileName()
public boolean isAppend()
public boolean isLocking()
public int getBufferSize()
public Map<String,String> getContentFormat()
Key: "fileURI" Value: provided "advertiseURI" param
.getContentFormat
in class AbstractManager
Copyright © 1999-2016 Apache Software Foundation. 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.