Vadim Pakhnushev created IGNITE-27935:
-----------------------------------------
Summary: Add custom checkstyle rule to detect logger class
mismatches
Key: IGNITE-27935
URL: https://issues.apache.org/jira/browse/IGNITE-27935
Project: Ignite
Issue Type: Improvement
Reporter: Vadim Pakhnushev
Logger fields are sometimes copy-pasted between classes, leading to bugs where
the class argument doesn't match the enclosing class:
class Bar {
// BUG: should be Bar.class
private static final Logger LOG = LoggerFactory.getLogger(Foo.class);
}
Add a new modules/checkstyle-custom module containing LoggerClassMismatchCheck
- a custom checkstyle rule that detects when a static final logger field is
initialized with a class literal that doesn't match the enclosing class.
The check covers all four logger factory patterns used in the codebase:
LoggerFactory.getLogger(), LogManager.getLogger(), Loggers.forClass(), and
CliLoggers.forClass().
Both field name pattern and factory method names are configurable via XML
properties.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)