[ 
https://issues.apache.org/jira/browse/IGNITE-27935?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Vadim Pakhnushev updated IGNITE-27935:
--------------------------------------
    Description: 
Logger fields are sometimes copy-pasted between classes, leading to bugs where 
the class argument doesn't match the enclosing class:
{code:java}
class Bar {
    // BUG: should be Bar.class
    private static final Logger LOG = LoggerFactory.getLogger(Foo.class);
}
{code}
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.

  was:
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.


> 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
>            Assignee: Vadim Pakhnushev
>            Priority: Major
>              Labels: ignite-3
>
> Logger fields are sometimes copy-pasted between classes, leading to bugs 
> where the class argument doesn't match the enclosing class:
> {code:java}
> class Bar {
>     // BUG: should be Bar.class
>     private static final Logger LOG = LoggerFactory.getLogger(Foo.class);
> }
> {code}
> 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)

Reply via email to