Class JavaLoggingInfoStream

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable

    public final class JavaLoggingInfoStream
    extends InfoStream
    InfoStream implementation that logs every message using Java Utils Logging (JUL) with the supplied log level.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.Map<java.lang.String,​java.util.logging.Logger> cache  
      private java.util.function.Function<java.lang.String,​java.lang.String> componentToLoggerName  
      private java.util.logging.Level level  
    • Constructor Summary

      Constructors 
      Constructor Description
      JavaLoggingInfoStream​(java.lang.String namePrefix, java.util.logging.Level level)
      Gets an implementation that logs using the given log level and adds a prefix to the component name.
      JavaLoggingInfoStream​(java.util.function.Function<java.lang.String,​java.lang.String> componentToLoggerName, java.util.logging.Level level)
      Gets an implementation that logs using the given log level with a logger name derived from the component name.
      JavaLoggingInfoStream​(java.util.logging.Level level)
      Gets an implementation using the given log level with a default prefix "org.apache.lucene.".
    • Field Detail

      • cache

        private final java.util.Map<java.lang.String,​java.util.logging.Logger> cache
      • componentToLoggerName

        private final java.util.function.Function<java.lang.String,​java.lang.String> componentToLoggerName
      • level

        private final java.util.logging.Level level
    • Constructor Detail

      • JavaLoggingInfoStream

        public JavaLoggingInfoStream​(java.util.logging.Level level)
        Gets an implementation using the given log level with a default prefix "org.apache.lucene.".
        Parameters:
        level - Requested log level to be used while logging
      • JavaLoggingInfoStream

        public JavaLoggingInfoStream​(java.lang.String namePrefix,
                                     java.util.logging.Level level)
        Gets an implementation that logs using the given log level and adds a prefix to the component name.
        Parameters:
        namePrefix - Prefix to be applied to all component names. It must be empty or include a final dot
        level - Requested log level to be used while logging
      • JavaLoggingInfoStream

        public JavaLoggingInfoStream​(java.util.function.Function<java.lang.String,​java.lang.String> componentToLoggerName,
                                     java.util.logging.Level level)
        Gets an implementation that logs using the given log level with a logger name derived from the component name.
        Parameters:
        componentToLoggerName - A function to convert a component name to a valid JUL logger name
        level - Requested log level to be used while logging
    • Method Detail

      • message

        public void message​(java.lang.String component,
                            java.lang.String message)
        Description copied from class: InfoStream
        prints a message
        Specified by:
        message in class InfoStream
      • close

        public void close()
      • getLogger

        private java.util.logging.Logger getLogger​(java.lang.String component)