org.apache.logging.log4j.core.appender.rolling
Class RollingRandomAccessFileManager

java.lang.Object
  extended by org.apache.logging.log4j.core.appender.AbstractManager
      extended by org.apache.logging.log4j.core.appender.OutputStreamManager
          extended by org.apache.logging.log4j.core.appender.FileManager
              extended by org.apache.logging.log4j.core.appender.rolling.RollingFileManager
                  extended by 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.


Field Summary
static int DEFAULT_BUFFER_SIZE
          The default buffer size
 
Fields inherited from class org.apache.logging.log4j.core.appender.OutputStreamManager
layout
 
Fields inherited from class org.apache.logging.log4j.core.appender.AbstractManager
count, LOGGER
 
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 org.apache.logging.log4j.core.appender.rolling.RollingFileManager
checkRollover, getFileManager, getFileSize, getFileTime, getPatternProcessor, getRolloverStrategy, getTriggeringPolicy
 
Methods inherited from class org.apache.logging.log4j.core.appender.FileManager
getContentFormat, getFileManager, getFileName, isAppend, isLocking
 
Methods inherited from class org.apache.logging.log4j.core.appender.OutputStreamManager
getManager, getOutputStream, isOpen, releaseSub, setOutputStream, write, writeFooter
 
Methods inherited from class org.apache.logging.log4j.core.appender.AbstractManager
getCount, getName, hasManager, release
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_BUFFER_SIZE

public static final int DEFAULT_BUFFER_SIZE
The default buffer size

See Also:
Constant Field Values
Constructor Detail

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)
Method Detail

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-2014 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.