squid:S3457 false positive for logger methods

127 views
Skip to first unread message

burge...@gmail.com

unread,
Feb 7, 2018, 6:13:03 AM2/7/18
to SonarQube
Rule squid:S3457 "Printf-style format strings should be used correctly" raises an issue when using regular logging methods for org.slf4j.Logger.
We regularly use logger debug level in order to more easily debug our applications on production environments via provided logs.
In some cases, we use logger debug method without any formatting arguments, which raises an issue.

Example usage:
private static final Logger logger = LoggerFactory.getLogger(UsedClass.class);

...

logger
.debug("Message usedto describe actual situation");

When an argument is used, or when an exception is provided as the second parameter the sonar issue is not thrown. I would expect this rule to ignore the above-mentioned situation.

Nicolas Peru

unread,
Feb 7, 2018, 8:27:12 AM2/7/18
to burge...@gmail.com, SonarQube
Hi, 

Thanks for feedback, this is a known issue and already fixed on our master branch of SonarJava : https://jira.sonarsource.com/browse/SONARJAVA-2633 

This should be delivered with the next version (5.2) of SonarJava.

Cheers, 

--
You received this message because you are subscribed to the Google Groups "SonarQube" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonarqube+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarqube/7e312c27-48b0-42a9-bbe6-d0a1105e8937%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
Nicolas Peru | SonarSource
Reply all
Reply to author
Forward
0 new messages