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.
|
size
byteBuffer, layout
count, 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()
Deprecated.
end-of-batch on the event is used instead.
|
void |
setEndOfBatch(boolean endOfBatch)
Deprecated.
end-of-batch on the event is used instead.
|
void |
updateData(Object data)
Updates the RollingFileManager's data during a reconfiguration.
|
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. |
addRolloverListener, checkRollover, createParentDir, getFileExtension, getFileManager, getFileName, getFileSize, getFileTime, getPatternProcessor, getRolloverStrategy, getTriggeringPolicy, initialize, isDirectWrite, isRenameEmptyFiles, releaseSub, removeRolloverListener, rollover, rollover, setPatternProcessor, setRenameEmptyFiles, setRolloverStrategy, setTriggeringPolicy
createOutputStream, defineAttributeView, getContentFormat, getFileGroup, getFileManager, getFileOwner, getFilePermissions, isAppend, isAttributeViewEnabled, isCreateOnDemand, isLocking
drain, flushBuffer, flushDestination, getByteBuffer, getManager, getOutputStream, hasOutputStream, isOpen, setOutputStream, skipFooter, write, write, write, writeBytes, writeBytes, writeFooter, writeHeader
close, getCount, getLoggerContext, getName, hasManager, log, logDebug, logError, logger, logWarn, narrow, release, stop
public 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)
@Deprecated public Boolean isEndOfBatch()
LogEvent.isEndOfBatch()
attribute is used instead.Boolean.FALSE
.@Deprecated public void setEndOfBatch(boolean endOfBatch)
LogEvent.isEndOfBatch()
attribute is used instead.
This method is a no-op.protected void write(byte[] bytes, int offset, int length, boolean immediateFlush)
OutputStreamManager
write
in class RollingFileManager
bytes
- 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)
FileManager
OutputStreamManager.writeToDestination(byte[], int, int)
to add support for file locking.writeToDestination
in class RollingFileManager
bytes
- the array containing dataoffset
- from where to writelength
- how many bytes to writeprotected void createFileAfterRollover() throws IOException
createFileAfterRollover
in class RollingFileManager
IOException
public void flush()
OutputStreamManager
flush
in class OutputStreamManager
public boolean closeOutputStream()
closeOutputStream
in class OutputStreamManager
public int getBufferSize()
getBufferSize
in class FileManager
public void updateData(Object data)
updateData
in class RollingFileManager
data
- The data to update.Copyright © 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.