org.apache.logging.log4j.core.appender.rolling
Class RollingRandomAccessFileManager
java.lang.Object
org.apache.logging.log4j.core.appender.AbstractManager
org.apache.logging.log4j.core.appender.OutputStreamManager
org.apache.logging.log4j.core.appender.FileManager
org.apache.logging.log4j.core.appender.rolling.RollingFileManager
org.apache.logging.log4j.core.appender.rolling.RollingRandomAccessFileManager
public class RollingRandomAccessFileManager
- extends RollingFileManager
Extends RollingFileManager but instead of using a buffered output stream,
this class uses a ByteBuffer
and a RandomAccessFile
to do the
I/O.
Constructor Summary |
RollingRandomAccessFileManager(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)
|
Method Summary |
void |
close()
|
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)
|
Boolean |
isEndOfBatch()
|
void |
setEndOfBatch(boolean isEndOfBatch)
|
protected void |
write(byte[] bytes,
int offset,
int length)
Some output streams synchronize writes while others do not. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DEFAULT_BUFFER_SIZE
public static final int DEFAULT_BUFFER_SIZE
- The default buffer size
- See Also:
- Constant Field Values
RollingRandomAccessFileManager
public RollingRandomAccessFileManager(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)
getRollingRandomAccessFileManager
public static RollingRandomAccessFileManager getRollingRandomAccessFileManager(String fileName,
String filePattern,
boolean isAppend,
boolean immediateFlush,
int bufferSize,
TriggeringPolicy policy,
RolloverStrategy strategy,
String advertiseURI,
Layout<? extends Serializable> layout)
isEndOfBatch
public Boolean isEndOfBatch()
setEndOfBatch
public void setEndOfBatch(boolean isEndOfBatch)
write
protected void write(byte[] bytes,
int offset,
int length)
- Description copied from class:
OutputStreamManager
- Some output streams synchronize writes while others do not. Synchronizing here insures that
log events won't be intertwined.
- Overrides:
write
in class RollingFileManager
- Parameters:
bytes
- The serialized Log event.offset
- The offset into the byte array.length
- The number of bytes to write.
createFileAfterRollover
protected void createFileAfterRollover()
throws IOException
- Overrides:
createFileAfterRollover
in class RollingFileManager
- Throws:
IOException
flush
public void flush()
- Description copied from class:
OutputStreamManager
- Flushes any buffers.
- Overrides:
flush
in class OutputStreamManager
close
public void close()
- Overrides:
close
in class OutputStreamManager
getBufferSize
public int getBufferSize()
- Returns the buffer capacity.
- Overrides:
getBufferSize
in class FileManager
- Returns:
- the buffer size
Copyright © 1999-2015 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.