Class RollingFileAppender

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

@Plugin(name="RollingFile", category="Core", elementType="appender", printObject=true) public final class RollingFileAppender extends AbstractOutputStreamAppender<RollingFileManager>
An appender that writes to files and can roll over at intervals.
  • Field Details

  • 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<RollingFileManager>
      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)
      Writes the log entry rolling over the file when required.
      Specified by:
      append in interface Appender
      append in class AbstractOutputStreamAppender<RollingFileManager>
      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.
    • getTriggeringPolicy

      public <T extends TriggeringPolicy> T getTriggeringPolicy()
      Returns the triggering policy.
      Type Parameters:
      T - TriggeringPolicy type
      The TriggeringPolicy
    • createAppender

      @Deprecated public static <B extends RollingFileAppender.Builder<B>> RollingFileAppender createAppender(String fileName, String filePattern, String append, String name, String bufferedIO, String bufferSizeStr, String immediateFlush, TriggeringPolicy policy, RolloverStrategy strategy, Layout<? extends Serializable> layout, Filter filter, String ignore, String advertise, String advertiseUri, Configuration config)
      Creates a RollingFileAppender.
      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).
      bufferedIO - When true, I/O will be buffered. Defaults to "true".
      bufferSizeStr - buffer size for buffered IO (default is 8192).
      immediateFlush - When true, events are immediately flushed. Defaults to "true".
      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.
      ignore - 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.
      config - The Configuration.
      A RollingFileAppender.
    • newBuilder

      @PluginBuilderFactory public static <B extends RollingFileAppender.Builder<B>> B newBuilder()
      Creates a new Builder.
      a new Builder.