I opened https://issues.apache.org/jira/browse/LUCENE-3598.
Uwe ----- Uwe Schindler H.-H.-Meier-Allee 63, D-28213 Bremen <http://www.thetaphi.de/> http://www.thetaphi.de eMail: [email protected] From: Uwe Schindler [mailto:[email protected]] Sent: Saturday, November 26, 2011 10:24 AM To: [email protected] 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 message. 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 message. 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 ----- Uwe Schindler H.-H.-Meier-Allee 63, D-28213 Bremen http://www.thetaphi.de <http://www.thetaphi.de/> eMail: [email protected] From: Shai Erera [mailto:[email protected]] Sent: Saturday, November 26, 2011 5:51 AM To: [email protected] Subject: IndexWriter.infoStream is final? Hi 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 IW. Does it mean that on trunk I cannot dynamically turn on/off debugging information? And why do 3x and trunk differ? Shai
