Package org.apache.lucene.util
Class JavaLoggingInfoStream
- java.lang.Object
-
- org.apache.lucene.util.InfoStream
-
- org.apache.lucene.util.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>cacheprivate java.util.function.Function<java.lang.String,java.lang.String>componentToLoggerNameprivate java.util.logging.Levellevel-
Fields inherited from class org.apache.lucene.util.InfoStream
NO_OUTPUT
-
-
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.".
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()private java.util.logging.LoggergetLogger(java.lang.String component)booleanisEnabled(java.lang.String component)returns true if messages are enabled and should be posted toInfoStream.message(java.lang.String, java.lang.String).voidmessage(java.lang.String component, java.lang.String message)prints a message-
Methods inherited from class org.apache.lucene.util.InfoStream
getDefault, setDefault
-
-
-
-
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 dotlevel- 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 namelevel- 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:InfoStreamprints a message- Specified by:
messagein classInfoStream
-
isEnabled
public boolean isEnabled(java.lang.String component)
Description copied from class:InfoStreamreturns true if messages are enabled and should be posted toInfoStream.message(java.lang.String, java.lang.String).- Specified by:
isEnabledin classInfoStream
-
close
public void close()
-
getLogger
private java.util.logging.Logger getLogger(java.lang.String component)
-
-