Class CompressedFileAppender

  • All Implemented Interfaces:
    org.apache.logging.log4j.core.Appender, org.apache.logging.log4j.core.filter.Filterable, org.apache.logging.log4j.core.impl.LocationAware, org.apache.logging.log4j.core.LifeCycle, org.apache.logging.log4j.core.LifeCycle2

    @Plugin(name="CompressedFile",
            category="Core",
            elementType="appender",
            printObject=true)
    public final class CompressedFileAppender
    extends org.apache.logging.log4j.core.appender.AbstractOutputStreamAppender<org.apache.logging.log4j.core.appender.FileManager>
    CompressedFile Appender.
    • Nested Class Summary

      • Nested classes/interfaces inherited from class org.apache.logging.log4j.core.appender.AbstractOutputStreamAppender

        org.apache.logging.log4j.core.appender.AbstractOutputStreamAppender.Builder<B extends org.apache.logging.log4j.core.appender.AbstractOutputStreamAppender.Builder<B>>
      • Nested classes/interfaces inherited from interface org.apache.logging.log4j.core.LifeCycle

        org.apache.logging.log4j.core.LifeCycle.State
    • Field Summary

      • Fields inherited from class org.apache.logging.log4j.core.AbstractLifeCycle

        DEFAULT_STOP_TIMEOUT, DEFAULT_STOP_TIMEUNIT, LOGGER
      • Fields inherited from interface org.apache.logging.log4j.core.Appender

        ELEMENT_TYPE
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static CompressedFileAppender createAppender​(String fileName, String append, String locking, String name, String immediateFlush, String ignore, String bufferedIo, String bufferSizeStr, org.apache.logging.log4j.core.Layout<? extends Serializable> layout, org.apache.logging.log4j.core.Filter filter, String advertise, String advertiseUri, int compressionLevel, org.apache.logging.log4j.core.config.Configuration config)
      Create a File Appender.
      String getFileName()
      Returns the file name this appender is associated with.
      boolean stop​(long timeout, TimeUnit timeUnit, boolean changeLifeCycleState)  
      • Methods inherited from class org.apache.logging.log4j.core.appender.AbstractOutputStreamAppender

        append, directEncodeEvent, getImmediateFlush, getManager, start, stop, writeByteArrayToManager
      • Methods inherited from class org.apache.logging.log4j.core.appender.AbstractAppender

        error, error, error, getHandler, getLayout, getName, ignoreExceptions, parseInt, requiresLocation, setHandler, toSerializable, toString
      • Methods inherited from class org.apache.logging.log4j.core.filter.AbstractFilterable

        addFilter, getFilter, getPropertyArray, hasFilter, isFiltered, removeFilter
      • Methods inherited from class org.apache.logging.log4j.core.AbstractLifeCycle

        equalsImpl, getState, getStatusLogger, hashCodeImpl, initialize, isInitialized, isStarted, isStarting, isStopped, isStopping, setStarted, setStarting, setState, setStopped, setStopping, stop, stop
      • Methods inherited from interface org.apache.logging.log4j.core.LifeCycle

        getState, initialize, isStarted, isStopped, stop
    • Method Detail

      • stop

        public boolean stop​(long timeout,
                            TimeUnit timeUnit,
                            boolean changeLifeCycleState)
        Overrides:
        stop in class org.apache.logging.log4j.core.appender.AbstractOutputStreamAppender<org.apache.logging.log4j.core.appender.FileManager>
      • getFileName

        public String getFileName()
        Returns the file name this appender is associated with.
        Returns:
        The File name.
      • createAppender

        @PluginFactory
        public static CompressedFileAppender createAppender​(@PluginAttribute("fileName")
                                                            String fileName,
                                                            @PluginAttribute("append")
                                                            String append,
                                                            @PluginAttribute("locking")
                                                            String locking,
                                                            @PluginAttribute("name")
                                                            String name,
                                                            @PluginAttribute("immediateFlush")
                                                            String immediateFlush,
                                                            @PluginAttribute("ignoreExceptions")
                                                            String ignore,
                                                            @PluginAttribute("bufferedIo")
                                                            String bufferedIo,
                                                            @PluginAttribute("bufferSize")
                                                            String bufferSizeStr,
                                                            @PluginElement("Layout")
                                                            org.apache.logging.log4j.core.Layout<? extends Serializable> layout,
                                                            @PluginElement("Filter")
                                                            org.apache.logging.log4j.core.Filter filter,
                                                            @PluginAttribute("advertise")
                                                            String advertise,
                                                            @PluginAttribute("advertiseUri")
                                                            String advertiseUri,
                                                            @PluginAttribute(value="compressionLevel",defaultInt=3)
                                                            int compressionLevel,
                                                            @PluginConfiguration
                                                            org.apache.logging.log4j.core.config.Configuration config)
        Create a File Appender.
        Parameters:
        fileName - The name and path of the file.
        append - "True" if the file should be appended to, "false" if it should be overwritten. The default is "true".
        locking - "True" if the file should be locked. The default is "false".
        name - The name of the Appender.
        immediateFlush - "true" if the contents should be flushed on every write, "false" otherwise. The default is "true".
        ignore - If "true" (default) exceptions encountered when appending events are logged; otherwise they are propagated to the caller.
        bufferedIo - "true" if I/O should be buffered, "false" otherwise. The default is "true".
        bufferSizeStr - buffer size for buffered IO (default is 8192).
        layout - The layout to use to format the event. If no layout is provided the default PatternLayout will be used.
        filter - The filter, if any, to use.
        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
        Returns:
        The FileAppender.