Affects PMD Version: 6.36.0
Rule: InvalidLogMessageFormat
Description:
Code Sample demonstrating the issue:
When using https://github.com/logfellow/logstash-logback-encoder for structured logging (example below), PMD detects it as false positive.
With markers:
import static net.logstash.logback.marker.Markers.*; // Add "foo:bar" to the JSON output LOGGER.info(append("foo", "bar"), "Some log message"); // Add "foo:bar,name:value" to the JSON output LOGGER.info(append("foo", "bar").and(append("name", "value")), "Some log message");
With structured arguments:
import static net.logstash.logback.argument.StructuredArguments.*; // Add "foo:bar" to JSON output and "bar" to log message LOGGER.info("log message {}", value("foo", "bar")); // Add "foo:bar" to JSON output only LOGGER.info("log message", keyValue("foo", "bar"));
Expected outcome:
PMD reports a violation at line ..., but that's wrong. That's a false positive.
Running PMD through: Gradle
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4