Wrap messages output with a check of InfoStream != null
-------------------------------------------------------
Key: LUCENE-1480
URL: https://issues.apache.org/jira/browse/LUCENE-1480
Project: Lucene - Java
Issue Type: Improvement
Components: Index
Reporter: Shai Erera
Priority: Minor
Fix For: 2.4.1
I've found several places in the code where messages are output w/o first
checking if infoStream != null. The result is that in most of the time,
unnecessary strings are created but never output (because infoStream is not
set). We should follow Java's logging best practices, where a log message is
always output in the following format:
if (logger.isLoggable(leve)) {
logger.log(level, msg);
}
Log messages are usually created w/o paying too much attention to performance
(such as string concatenation using '+' instead of StringBuffer). Therefore, at
runtime it is important to avoid creating those messages, if they will be
discarded eventually.
I will add a method to IndexWriter messagesEnabled() and then use it wherever a
call to iw.message() is made.
Patch will follow
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]