You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Shai Erera (JIRA)" <ji...@apache.org> on 2008/12/05 18:50:44 UTC

[jira] Commented: (LUCENE-1480) Wrap messages output with a check of InfoStream != null

    [ https://issues.apache.org/jira/browse/LUCENE-1480?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12653872#action_12653872 ] 

Shai Erera commented on LUCENE-1480:
------------------------------------

Hey Mike, I like the verbose() name. Would you like me to prepare a new patch, or can you apply the current patch and refactor the method name?
Note that a similar method was added to LogMergePolicy

> 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
>            Assignee: Michael McCandless
>            Priority: Minor
>             Fix For: 2.4.1
>
>         Attachments: LUCENE-1480.patch
>
>
> 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: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org