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 15:53:44 UTC

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

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: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


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

Posted by "Michael McCandless (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-1480?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12654142#action_12654142 ] 

Michael McCandless commented on LUCENE-1480:
--------------------------------------------

OK let's leave IndexWriter as-is.

> 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-2.patch, 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


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

Posted by "Michael McCandless (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-1480?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12654045#action_12654045 ] 

Michael McCandless commented on LUCENE-1480:
--------------------------------------------

Shai, did you intend on changing IndexWriter.java to use the verbose() method, too?  (You added a verbose() method but didn't use it).

> 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-2.patch, 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


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

Posted by "Michael McCandless (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-1480?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael McCandless reassigned LUCENE-1480:
------------------------------------------

    Assignee: Michael McCandless

> 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


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

Posted by "Shai Erera (JIRA)" <ji...@apache.org>.
    [ 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


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

Posted by "Shai Erera (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-1480?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12654116#action_12654116 ] 

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

In IndexWriter, almost all the code used if (infoStream != null) and I only fixed a small number of places which didn't do that. So instead of changing all of the places to use verbose(), I chose to keep most of the code unchanged.
I can see that using verbose() will be consistent, although I don't think it's critical in that case. But anyway, that's a quick change, so if you believe it's better, I can provide a 3rd patch.

> 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-2.patch, 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


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

Posted by "Shai Erera (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-1480?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Shai Erera updated LUCENE-1480:
-------------------------------

    Attachment: LUCENE-1480.patch

Patch that introduces messagesEnabled() in IndexWriter and fixes all calls to IndexWriter.message() to be wrapped by a call to messagesEnabled() or infoStream != null (in case of IndexWriter calls to message()).

> 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
>
>         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


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

Posted by "Michael McCandless (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-1480?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12653877#action_12653877 ] 

Michael McCandless commented on LUCENE-1480:
--------------------------------------------

Sorry, could you make a new patch?  Thanks.

> 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


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

Posted by "Shai Erera (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-1480?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Shai Erera updated LUCENE-1480:
-------------------------------

    Attachment: LUCENE-1480-2.patch

Renamed messagesEnabled to verbose. Thanks Mike !

> 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-2.patch, 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


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

Posted by "Michael McCandless (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-1480?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael McCandless resolved LUCENE-1480.
----------------------------------------

       Resolution: Fixed
    Fix Version/s:     (was: 2.4.1)
                   2.9
    Lucene Fields: [New, Patch Available]  (was: [Patch Available, New])

Committed revision 724033.  Thanks Shai!

> 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.9
>
>         Attachments: LUCENE-1480-2.patch, 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