Class RollingRandomAccessFileManager

  • All Implemented Interfaces:
    java.lang.AutoCloseable, ByteBufferDestination

    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 Detail

      • RollingRandomAccessFileManager

        @Deprecated
        public RollingRandomAccessFileManager​(LoggerContext loggerContext,
                                              java.io.RandomAccessFile raf,
                                              java.lang.String fileName,
                                              java.lang.String pattern,
                                              java.io.OutputStream os,
                                              boolean append,
                                              boolean immediateFlush,
                                              int bufferSize,
                                              long size,
                                              long time,
                                              TriggeringPolicy policy,
                                              RolloverStrategy strategy,
                                              java.lang.String advertiseURI,
                                              Layout<? extends java.io.Serializable> layout,
                                              boolean writeHeader)
        Deprecated.
      • RollingRandomAccessFileManager

        public RollingRandomAccessFileManager​(LoggerContext loggerContext,
                                              java.io.RandomAccessFile raf,
                                              java.lang.String fileName,
                                              java.lang.String pattern,
                                              java.io.OutputStream os,
                                              boolean append,
                                              boolean immediateFlush,
                                              int bufferSize,
                                              long size,
                                              long initialTime,
                                              TriggeringPolicy policy,
                                              RolloverStrategy strategy,
                                              java.lang.String advertiseURI,
                                              Layout<? extends java.io.Serializable> layout,
                                              java.lang.String filePermissions,
                                              java.lang.String fileOwner,
                                              java.lang.String fileGroup,
                                              boolean writeHeader)
        Since:
        2.8.3
    • Method Detail

      • writeHeader

        private void writeHeader()
        Writes the layout's header to the file if it exists.
      • getRollingRandomAccessFileManager

        public static RollingRandomAccessFileManager getRollingRandomAccessFileManager​(java.lang.String fileName,
                                                                                       java.lang.String filePattern,
                                                                                       boolean isAppend,
                                                                                       boolean immediateFlush,
                                                                                       int bufferSize,
                                                                                       TriggeringPolicy policy,
                                                                                       RolloverStrategy strategy,
                                                                                       java.lang.String advertiseURI,
                                                                                       Layout<? extends java.io.Serializable> layout,
                                                                                       java.lang.String filePermissions,
                                                                                       java.lang.String fileOwner,
                                                                                       java.lang.String fileGroup,
                                                                                       Configuration configuration)
      • isEndOfBatch

        @Deprecated
        public java.lang.Boolean isEndOfBatch()
        Deprecated.
        end-of-batch on the event is used instead.
        No longer used, the LogEvent.isEndOfBatch() attribute is used instead.
        Returns:
        Boolean.FALSE.
      • setEndOfBatch

        @Deprecated
        public void setEndOfBatch​(boolean endOfBatch)
        Deprecated.
        end-of-batch on the event is used instead.
        No longer used, the LogEvent.isEndOfBatch() attribute is used instead. This method is a no-op.
      • write

        protected void write​(byte[] bytes,
                             int offset,
                             int length,
                             boolean immediateFlush)
        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.
        immediateFlush - flushes immediately after writing.
      • createFileAfterRollover

        private void createFileAfterRollover​(java.lang.String fileName)
                                      throws java.io.IOException
        Throws:
        java.io.IOException
      • getBufferSize

        public int getBufferSize()
        Returns the buffer capacity.
        Overrides:
        getBufferSize in class FileManager
        Returns:
        the buffer size
      • updateData

        public void updateData​(java.lang.Object data)
        Updates the RollingFileManager's data during a reconfiguration. This method should be considered private. It is not thread safe and calling it outside of a reconfiguration may lead to errors. This method may be made protected in a future release.
        Overrides:
        updateData in class RollingFileManager
        Parameters:
        data - The data to update.