Class RollingRandomAccessFileAppender

All Implemented Interfaces:
Appender, Filterable, LocationAware, LifeCycle, LifeCycle2

@Plugin(name="RollingRandomAccessFile", category="Core", elementType="appender", printObject=true) public final class RollingRandomAccessFileAppender extends AbstractOutputStreamAppender<RollingRandomAccessFileManager>
An appender that writes to random access files and can roll over at intervals.
  • Method Details

    • stop

      public boolean stop(long timeout, TimeUnit timeUnit)
      Description copied from class: AbstractFilterable
      Cleanup the Filter.
      Specified by:
      stop in interface LifeCycle2
      stop in class AbstractOutputStreamAppender<RollingRandomAccessFileManager>
      timeout - the maximum time to wait
      timeUnit - the time unit of the timeout argument
      true if the receiver was stopped cleanly and normally, false otherwise.
    • append

      public void append(LogEvent event)
      Write the log entry rolling over the file when required.
      Specified by:
      append in interface Appender
      append in class AbstractOutputStreamAppender<RollingRandomAccessFileManager>
      event - The LogEvent.
    • getFileName

      public String getFileName()
      Returns the File name for the Appender.
      The file name.
    • getFilePattern

      public String getFilePattern()
      Returns the file pattern used when rolling over.
      The file pattern.
    • getBufferSize

      public int getBufferSize()
      Returns the size of the file manager's buffer.
      the buffer size
    • createAppender

      @Deprecated public static <B extends RollingRandomAccessFileAppender.Builder<B>> RollingRandomAccessFileAppender createAppender(String fileName, String filePattern, String append, String name, String immediateFlush, String bufferSizeStr, TriggeringPolicy policy, RolloverStrategy strategy, Layout<? extends Serializable> layout, Filter filter, String ignoreExceptions, String advertise, String advertiseURI, Configuration configuration)
      Create a RollingRandomAccessFileAppender.
      fileName - The name of the file that is actively written to. (required).
      filePattern - The pattern of the file name to use on rollover. (required).
      append - If true, events are appended to the file. If false, the file is overwritten when opened. Defaults to "true"
      name - The name of the Appender (required).
      immediateFlush - When true, events are immediately flushed. Defaults to "true".
      bufferSizeStr - The buffer size, defaults to 262144.
      policy - The triggering policy. (required).
      strategy - The rollover strategy. Defaults to DefaultRolloverStrategy.
      layout - The layout to use (defaults to the default PatternLayout).
      filter - The Filter or null.
      ignoreExceptions - If "true" (default) exceptions encountered when appending events are logged; otherwise they are propagated to the caller.
      advertise - "true" if the appender configuration should be advertised, "false" otherwise.
      advertiseURI - The advertised URI which can be used to retrieve the file contents.
      configuration - The Configuration.
      A RollingRandomAccessFileAppender.
    • newBuilder

      @PluginBuilderFactory public static <B extends RollingRandomAccessFileAppender.Builder<B>> B newBuilder()