AutoCloseable, ByteBufferDestinationRollingFileManagerpublic class FileManager extends OutputStreamManager
count, LOGGERbyteBuffer, layout| Modifier | Constructor | Description |
|---|---|---|
protected |
FileManager(String fileName,
OutputStream os,
boolean append,
boolean locking,
String advertiseURI,
Layout<? extends Serializable> layout,
boolean writeHeader,
ByteBuffer buffer) |
Deprecated.
|
protected |
FileManager(String fileName,
OutputStream os,
boolean append,
boolean locking,
String advertiseURI,
Layout<? extends Serializable> layout,
int bufferSize,
boolean writeHeader) |
Deprecated.
|
protected |
FileManager(LoggerContext loggerContext,
String fileName,
OutputStream os,
boolean append,
boolean locking,
boolean createOnDemand,
String advertiseURI,
Layout<? extends Serializable> layout,
boolean writeHeader,
ByteBuffer buffer) |
Deprecated.
|
protected |
FileManager(LoggerContext loggerContext,
String fileName,
OutputStream os,
boolean append,
boolean locking,
boolean createOnDemand,
String advertiseURI,
Layout<? extends Serializable> layout,
String filePermissions,
String fileOwner,
String fileGroup,
boolean writeHeader,
ByteBuffer buffer) |
| Modifier and Type | Method | Description |
|---|---|---|
protected OutputStream |
createOutputStream() |
|
protected void |
defineAttributeView(Path path) |
|
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. |
String |
getFileGroup() |
Returns file group if defined and the OS supports posix/group file attribute view,
null otherwise.
|
static FileManager |
getFileManager(String fileName,
boolean append,
boolean locking,
boolean bufferedIo,
boolean createOnDemand,
String advertiseUri,
Layout<? extends Serializable> layout,
int bufferSize,
String filePermissions,
String fileOwner,
String fileGroup,
Configuration configuration) |
Returns the FileManager.
|
String |
getFileName() |
Returns the name of the File being managed.
|
String |
getFileOwner() |
Returns file owner if defined and the OS supports owner file attribute view,
null otherwise.
|
Set<PosixFilePermission> |
getFilePermissions() |
Returns posix file permissions if defined and the OS supports posix file attribute,
null otherwise.
|
boolean |
isAppend() |
Returns the append status.
|
boolean |
isAttributeViewEnabled() |
Returns true if file attribute view enabled for this file manager.
|
boolean |
isCreateOnDemand() |
Returns the lazy-create.
|
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.
|
protected void |
writeToDestination(byte[] bytes,
int offset,
int length) |
Overrides
OutputStreamManager.writeToDestination(byte[], int, int) to add support for file locking. |
close, getCount, getLoggerContext, getName, hasManager, log, logDebug, logError, logWarn, narrow, release, stop, updateDataclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcloseOutputStream, drain, flush, flushBuffer, flushDestination, getByteBuffer, getManager, getOutputStream, hasOutputStream, isOpen, releaseSub, setOutputStream, skipFooter, write, write, write, writeBytes, writeBytes, writeFooter@Deprecated protected FileManager(String fileName, OutputStream os, boolean append, boolean locking, String advertiseURI, Layout<? extends Serializable> layout, int bufferSize, boolean writeHeader)
@Deprecated protected FileManager(String fileName, OutputStream os, boolean append, boolean locking, String advertiseURI, Layout<? extends Serializable> layout, boolean writeHeader, ByteBuffer buffer)
@Deprecated protected FileManager(LoggerContext loggerContext, String fileName, OutputStream os, boolean append, boolean locking, boolean createOnDemand, String advertiseURI, Layout<? extends Serializable> layout, boolean writeHeader, ByteBuffer buffer)
protected FileManager(LoggerContext loggerContext, String fileName, OutputStream os, boolean append, boolean locking, boolean createOnDemand, String advertiseURI, Layout<? extends Serializable> layout, String filePermissions, String fileOwner, String fileGroup, boolean writeHeader, ByteBuffer buffer)
public static FileManager getFileManager(String fileName, boolean append, boolean locking, boolean bufferedIo, boolean createOnDemand, String advertiseUri, Layout<? extends Serializable> layout, int bufferSize, String filePermissions, String fileOwner, String fileGroup, Configuration configuration)
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.createOnDemand - true if you want to lazy-create the file (a.k.a. on-demand.)advertiseUri - the URI to use when advertising the filelayout - The layoutbufferSize - buffer size for buffered IOfilePermissions - File permissionsfileOwner - File ownerfileOwner - File groupconfiguration - The configuration.protected OutputStream createOutputStream() throws IOException
createOutputStream in class OutputStreamManagerIOExceptionprotected void defineAttributeView(Path path)
protected void write(byte[] bytes,
int offset,
int length,
boolean immediateFlush)
OutputStreamManagerwrite in class OutputStreamManagerbytes - The serialized Log event.offset - The offset into the byte array.length - The number of bytes to write.immediateFlush - flushes immediately after writing.protected void writeToDestination(byte[] bytes,
int offset,
int length)
OutputStreamManager.writeToDestination(byte[], int, int) to add support for file locking.writeToDestination in class OutputStreamManagerbytes - the array containing dataoffset - from where to writelength - how many bytes to writepublic String getFileName()
public boolean isAppend()
public boolean isCreateOnDemand()
public boolean isLocking()
public int getBufferSize()
public Set<PosixFilePermission> getFilePermissions()
PosixFileAttributeViewpublic String getFileOwner()
FileOwnerAttributeViewpublic String getFileGroup()
PosixFileAttributeViewpublic boolean isAttributeViewEnabled()
public Map<String,String> getContentFormat()
Key: "fileURI" Value: provided "advertiseURI" param.getContentFormat in class AbstractManagerCopyright © 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.