lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Uwe Schindler" <>
Subject RE: IndexWriter.infoStream is final?
Date Sat, 26 Nov 2011 10:09:26 GMT
I opened





Uwe Schindler

H.-H.-Meier-Allee 63, D-28213 Bremen




From: Uwe Schindler [] 
Sent: Saturday, November 26, 2011 10:24 AM
Subject: RE: IndexWriter.infoStream is final?


You can still torn on/off logging. In Lucene trunk info stream is just an
abstract interface, the cool thing is that you can implement this interface
on your own (and by that enable/disable logging):


public abstract class InfoStream {

  public abstract void message(String component, String message);



I use the new interface to pass it through to log4j or whatever as debug


I already discussed with Robert about that, that there is one thing missing.
Currently the IW only checks if the infoStream!=null and then passes the
message to the method, and that *may* ignore it. For your requirement it is
the case that this is enabled or disabled dynamically. Unfortunately if the
construction of the message is heavy, then this wastes resources.


I would like to add another method to this class: abstract boolean
isMessageEnabled() that can also be implemented. I would then replace all
null checks in IW by this method. The default config in IW would be changed
to use a DoNothingInfoStream() that returns false here and ignores the


A simple logger wrapper for e.g. log4j / slf4j then could look like:


Loger log = YourLoggingFramework.getLogger(IndexWriter.class);


public void message(String component, String message) {

     log.debug(component + ": " + message);



public Boolean isMessageEnabled() {

return log.isDebugEnabled();



Using this you could enable/disable logging live by e.g. the log4j
management console of your app server by enabling/disabling
IndexWriter.class logging.


Maybe we should open a new issue about this, I just had no time to do that.





Uwe Schindler

H.-H.-Meier-Allee 63, D-28213 Bremen <> 



From: Shai Erera [] 
Sent: Saturday, November 26, 2011 5:51 AM
Subject: IndexWriter.infoStream is final?



I was surprised to see IW.infoStream was made final. Reading through
LUCENE-2960 I got the impression that it was one the settings that we wanted
to keep 'live'. More so, on 3x it's still lively settable without any
deprecation warnings, while in trunk it was moved to IWC and made final in

Does it mean that on trunk I cannot dynamically turn on/off debugging
information? And why do 3x and trunk differ?


View raw message