Package org.spf4j.log

Class AvroDataFileAppender

  • All Implemented Interfaces:
    ch.qos.logback.core.Appender<ch.qos.logback.classic.spi.ILoggingEvent>, ch.qos.logback.core.spi.ContextAware, ch.qos.logback.core.spi.FilterAttachable<ch.qos.logback.classic.spi.ILoggingEvent>, ch.qos.logback.core.spi.LifeCycle

    public final class AvroDataFileAppender
    extends ch.qos.logback.core.UnsynchronizedAppenderBase<ch.qos.logback.classic.spi.ILoggingEvent>
    an Appender that will log into binary avro data files. Files will be be partition by day. Day boundaries are determined by the provided zone id.
    Author:
    Zoltan Farkas
    • Constructor Detail

      • AvroDataFileAppender

        public AvroDataFileAppender()
    • Method Detail

      • setAppendRetries

        public void setAppendRetries​(int appendRetries)
        When serializing a object a ConcurrentModificationEnception can be thrown if this is mutated by another thread. (async logging) this can re-tried, a few times, and hopefully log this successfully.
        Parameters:
        appendRetries -
      • setMaxNrFiles

        public void setMaxNrFiles​(int maxNrFiles)
      • setMaxLogsBytes

        public void setMaxLogsBytes​(long maxLogsBytes)
      • setCodec

        public void setCodec​(String codec)
      • setFileNameBase

        public void setFileNameBase​(String fileNameBase)
      • setDestinationPath

        public void setDestinationPath​(String destinationPath)
      • setPartitionZoneID

        public void setPartitionZoneID​(String zoneIdStr)
      • getDestinationPath

        public Path getDestinationPath()
      • getCurrentFile

        public Path getCurrentFile()
      • getCurrentLogs

        public org.apache.avro.file.FileReader<org.spf4j.base.avro.LogRecord> getCurrentLogs()
                                                                                      throws IOException
        Throws:
        IOException
      • readLogs

        public static void readLogs​(org.spf4j.log.AvroDataFileAppender.LogFileRange fileRange,
                                    org.apache.avro.io.DatumReader<org.spf4j.base.avro.LogRecord> reader,
                                    String originPrefix,
                                    Consumer<org.spf4j.base.avro.LogRecord> records)
                             throws IOException
        Throws:
        IOException
      • getFilteredLogs

        public void getFilteredLogs​(String originPrefix,
                                    long ptailOffset,
                                    long limit,
                                    Predicate<org.spf4j.base.avro.LogRecord> pred,
                                    Consumer<org.spf4j.base.avro.LogRecord> records)
                             throws IOException
        Throws:
        IOException
      • skip

        public static void skip​(org.apache.avro.file.DataFileStream<org.spf4j.base.avro.LogRecord> it,
                                long count)
                         throws IOException
        Throws:
        IOException
      • stop

        public void stop()
        Specified by:
        stop in interface ch.qos.logback.core.spi.LifeCycle
        Overrides:
        stop in class ch.qos.logback.core.UnsynchronizedAppenderBase<ch.qos.logback.classic.spi.ILoggingEvent>
      • start

        public void start()
        Specified by:
        start in interface ch.qos.logback.core.spi.LifeCycle
        Overrides:
        start in class ch.qos.logback.core.UnsynchronizedAppenderBase<ch.qos.logback.classic.spi.ILoggingEvent>
      • append

        protected void append​(ch.qos.logback.classic.spi.ILoggingEvent eventObject)
        Specified by:
        append in class ch.qos.logback.core.UnsynchronizedAppenderBase<ch.qos.logback.classic.spi.ILoggingEvent>
      • toString

        public String toString()
        Overrides:
        toString in class ch.qos.logback.core.UnsynchronizedAppenderBase<ch.qos.logback.classic.spi.ILoggingEvent>