Affects PMD Version: 6.53.0, 6.55.0
Rule: GuardLogStatement
Description:
PMD reports a violation when Log4j parameterized logs are used. We are in the process of converting all logs from concatenated strings to parameterized logs, using PMD to find offending logs. But PMD reports the same logs even after updating.
Code Sample demonstrating the issue:
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
class Test {
private static final Logger LOGGER = LogManager.getLogger(Test.class);
public static void main() {
LOGGER.info("Info : {} : Request received", LOGGER.getName());
String s = "Hello World";
LOGGER.debug("Logging string {}", s);
}
}
Expected outcome:
PMD reports a violation at lines 8 and 10, but that's wrong. That's a false positive.
Running PMD through: Maven
P.S. I saw someone else report the same false-positive on another issue - #3144 (comment)
Affects PMD Version: 6.53.0, 6.55.0
Rule: GuardLogStatement
Description:
PMD reports a violation when Log4j parameterized logs are used. We are in the process of converting all logs from concatenated strings to parameterized logs, using PMD to find offending logs. But PMD reports the same logs even after updating.
Code Sample demonstrating the issue:
Expected outcome:
PMD reports a violation at lines 8 and 10, but that's wrong. That's a false positive.
Running PMD through: Maven
P.S. I saw someone else report the same false-positive on another issue - #3144 (comment)