[infinispan-issues] [JBoss JIRA] (ISPN-1429) Remove if(trace) checks wherever possible

Manik Surtani (Resolved) (JIRA) jira-events at lists.jboss.org
Sat Jan 7 12:03:11 EST 2012


     [ https://issues.jboss.org/browse/ISPN-1429?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Manik Surtani resolved ISPN-1429.
---------------------------------

    Fix Version/s:     (was: 5.1.0.FINAL)
                       (was: 5.1.0.CR3)
       Resolution: Rejected

    
> Remove if(trace) checks wherever possible
> -----------------------------------------
>
>                 Key: ISPN-1429
>                 URL: https://issues.jboss.org/browse/ISPN-1429
>             Project: Infinispan
>          Issue Type: Enhancement
>    Affects Versions: 5.0.0.FINAL
>            Reporter: Mircea Markus
>            Assignee: Manik Surtani
>            Priority: Minor
>
> Citing from David Lloyd's email:
> <snip>
> If you're using the jboss-logging API, and your log statement does not 
> do any interpolation, then it is just as fast to do any of the following 
> (with no if):
>    log.trace("blah");
>    log.tracef("the %s happened to %s", foo, bar);
>    log.tracev("the {0} happened to {1}", foo, bar);
> In the case where trace logging is disabled, these are exactly as 
> efficient as the if (log.isTraceEnabled()) variants.  In the case where 
> it is enabled, it is marginally more efficient (though the trace log 
> itself is substantially more expensive of course).
> Overall I'd avoid the "if" forms unless you're doing complex interpolation:
>    log.trace("Foo " + bar + " baz " + zap);
>    log.tracef("the %s happened to %s", fooMethod().barMethod(), bar);
> ...both of which incur the expense of the expression resolution even if 
> the log message is ultimately discarded.
> </snip>
> This JIRA is about:
> 1. removing all the "if (trace)" statements from the code (where possible, see below)
> 2. making sure that this is a documented policy and people are aware of it

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the infinispan-issues mailing list