com.atlassian.confluence.search.v2.lucene
Class Slf4JInfoStream

java.lang.Object
  extended by org.apache.lucene.util.InfoStream
      extended by com.atlassian.confluence.search.v2.lucene.Slf4JInfoStream
All Implemented Interfaces:
java.io.Closeable, java.lang.Cloneable, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.InitializingBean

public class Slf4JInfoStream
extends org.apache.lucene.util.InfoStream
implements org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.DisposableBean

Adapts Lucene's logging mechanism, InfoStream, to SLF4J.

In InfoStream, messages are categorised by "components". Generally a component is the class name or an acronym of it, e.g. the component of org.apache.lucene.index.IndexUpgrader is IndexUpgrader and the component of org.apache.lucene.index.DocumentsWriter is DW. Since there's no concept of log levels, all messages are logged under debug.

A Spring-managed instance will replace the default InfoStream within its lifecycle, thus it only makes sense to have a singleton registered.


Field Summary
 
Fields inherited from class org.apache.lucene.util.InfoStream
NO_OUTPUT
 
Constructor Summary
Slf4JInfoStream(java.util.Map<java.lang.String,java.lang.String> componentToLoggerMapping)
           
 
Method Summary
 void afterPropertiesSet()
           
 void close()
           
 void destroy()
           
 boolean isEnabled(java.lang.String component)
           
 void message(java.lang.String component, java.lang.String message)
           
 
Methods inherited from class org.apache.lucene.util.InfoStream
clone, getDefault, setDefault
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Slf4JInfoStream

public Slf4JInfoStream(java.util.Map<java.lang.String,java.lang.String> componentToLoggerMapping)
Parameters:
componentToLoggerMapping - maps component names to logger names, defaults to logger if no mapping could be found
Method Detail

message

public void message(java.lang.String component,
                    java.lang.String message)
Specified by:
message in class org.apache.lucene.util.InfoStream

isEnabled

public boolean isEnabled(java.lang.String component)
Specified by:
isEnabled in class org.apache.lucene.util.InfoStream

close

public void close()
Specified by:
close in interface java.io.Closeable

destroy

public void destroy()
             throws java.lang.Exception
Specified by:
destroy in interface org.springframework.beans.factory.DisposableBean
Throws:
java.lang.Exception

afterPropertiesSet

public void afterPropertiesSet()
                        throws java.lang.Exception
Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Throws:
java.lang.Exception


Copyright © 2003-2014 Atlassian. All Rights Reserved.