public class RollingRandomAccessFileManager extends RollingFileManager
ByteBuffer and a
RandomAccessFile to do the I/O.| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_BUFFER_SIZE
The default buffer size.
|
sizebyteBuffer, layoutcount, LOGGER| Constructor and Description |
|---|
RollingRandomAccessFileManager(LoggerContext loggerContext,
RandomAccessFile raf,
String fileName,
String pattern,
OutputStream os,
boolean append,
boolean immediateFlush,
int bufferSize,
long size,
long time,
TriggeringPolicy policy,
RolloverStrategy strategy,
String advertiseURI,
Layout<? extends Serializable> layout,
boolean writeHeader)
Deprecated.
|
RollingRandomAccessFileManager(LoggerContext loggerContext,
RandomAccessFile raf,
String fileName,
String pattern,
OutputStream os,
boolean append,
boolean immediateFlush,
int bufferSize,
long size,
long initialTime,
TriggeringPolicy policy,
RolloverStrategy strategy,
String advertiseURI,
Layout<? extends Serializable> layout,
String filePermissions,
String fileOwner,
String fileGroup,
boolean writeHeader) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
closeOutputStream() |
protected void |
createFileAfterRollover() |
void |
flush()
Flushes any buffers.
|
int |
getBufferSize()
Returns the buffer capacity.
|
static RollingRandomAccessFileManager |
getRollingRandomAccessFileManager(String fileName,
String filePattern,
boolean isAppend,
boolean immediateFlush,
int bufferSize,
TriggeringPolicy policy,
RolloverStrategy strategy,
String advertiseURI,
Layout<? extends Serializable> layout,
String filePermissions,
String fileOwner,
String fileGroup,
Configuration configuration) |
Boolean |
isEndOfBatch() |
void |
setEndOfBatch(boolean endOfBatch) |
void |
updateData(Object data) |
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. |
checkRollover, getFileExtension, getFileManager, getFileName, getFileSize, getFileTime, getPatternProcessor, getRolloverStrategy, getTriggeringPolicy, initialize, isRenameEmptyFiles, releaseSub, rollover, rollover, setPatternProcessor, setRenameEmptyFiles, setRolloverStrategy, setTriggeringPolicycreateOutputStream, defineAttributeView, getContentFormat, getFileGroup, getFileManager, getFileOwner, getFilePermissions, isAppend, isAttributeViewEnabled, isCreateOnDemand, isLockingdrain, flushBuffer, flushDestination, getByteBuffer, getManager, getOutputStream, hasOutputStream, isOpen, setOutputStream, skipFooter, write, write, write, writeBytes, writeBytes, writeFooterclose, getCount, getLoggerContext, getName, hasManager, log, logDebug, logError, logger, logWarn, narrow, release, stoppublic static final int DEFAULT_BUFFER_SIZE
@Deprecated public RollingRandomAccessFileManager(LoggerContext loggerContext, RandomAccessFile raf, String fileName, String pattern, OutputStream os, boolean append, boolean immediateFlush, int bufferSize, long size, long time, TriggeringPolicy policy, RolloverStrategy strategy, String advertiseURI, Layout<? extends Serializable> layout, boolean writeHeader)
public RollingRandomAccessFileManager(LoggerContext loggerContext, RandomAccessFile raf, String fileName, String pattern, OutputStream os, boolean append, boolean immediateFlush, int bufferSize, long size, long initialTime, TriggeringPolicy policy, RolloverStrategy strategy, String advertiseURI, Layout<? extends Serializable> layout, String filePermissions, String fileOwner, String fileGroup, boolean writeHeader)
public static RollingRandomAccessFileManager getRollingRandomAccessFileManager(String fileName, String filePattern, boolean isAppend, boolean immediateFlush, int bufferSize, TriggeringPolicy policy, RolloverStrategy strategy, String advertiseURI, Layout<? extends Serializable> layout, String filePermissions, String fileOwner, String fileGroup, Configuration configuration)
public Boolean isEndOfBatch()
public void setEndOfBatch(boolean endOfBatch)
protected void write(byte[] bytes,
int offset,
int length,
boolean immediateFlush)
OutputStreamManagerwrite in class RollingFileManagerbytes - 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)
FileManagerOutputStreamManager.writeToDestination(byte[], int, int) to add support for file locking.writeToDestination in class RollingFileManagerbytes - the array containing dataoffset - from where to writelength - how many bytes to writeprotected void createFileAfterRollover()
throws IOException
createFileAfterRollover in class RollingFileManagerIOExceptionpublic void flush()
OutputStreamManagerflush in class OutputStreamManagerpublic boolean closeOutputStream()
closeOutputStream in class OutputStreamManagerpublic int getBufferSize()
getBufferSize in class FileManagerpublic void updateData(Object data)
updateData in class RollingFileManagerCopyright © 1999-2021 The 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.