title: Sonar violation: Invoke method(s) only conditionally
body: <p>Our company just started a sonar farm. I was curious about our code quality and wanted to improve.</p>
  
  <p>I have a code containing such logger calls:</p>
  
  <pre><code>LOGGER.error(String.format("Cannot load object in status %s (%s)", status, statusDescription), e);
  
  LOGGER.info(String.format("%s object(s) loaded in status %s (%s)", objects.size(), status, statusDescription));
  </code></pre>
  
  <p>Sonar triggers rule squid:S262, Invoke method(s) only conditionally <i>"Preconditions" and logging arguments should not require evaluation</i>. Rule triggered by both theses lines. </p>
  
  <p>About this one, I'm not really sure to understand what's going on. The explanation seams not well fitting to my use case. Sonar doc provided this example:</p>
  
  <pre><code>logger.log(Level.DEBUG, "Something went wrong: " + message);  // Noncompliant; string concatenation performed even when log level too high to show DEBUG messages
  </code></pre>
  
  <p>which I perfectly understand (debug will not be logged in production, thus unnecessary operations will occurs). But for info and error level, I would assume that you want to log it anyway. Moreover, in my case, I want both to be logged.</p>
  
  <p>Which is the good approach ? 
  Rewrite differently not using String.format ? Tune sonar to not fire on info/error level ? Just ignore sonar on this one ? Something else ?</p>