Hello,
Rule squid:S1312, Loggers should be "private static final" and should share a naming convention defines the allowable logger name as the regex "LOG(?:GER)". In other words, only LOG or LOGGER are allowed.
An example of a compliant solution is:
public static final Logger LOG = LoggerFactory.getLogger(Foo.class);
Because of the naming convention restriction, this effectively limits the number of loggers per class to one, or the horribly worse case two, if you name one of them LOG and the other LOGGER!
On occasion there is legitimate reason to have more than one logger in a class for logging different things to different loggers. Consider example:
public static final Logger LOG = LoggerFactory.getLogger(Foo.class);
public static final Logger LOG_STATISTICS = LoggerFactory.getLogger("STATISTICS");
public static final Logger LOG_COMPLIANCE = LoggerFactory.getLogger("COMPLIANCE");
I propose that the allowable logger names be expanded to allow any valid constant-style name (all uppercase with underscores) that begin with LOG_ or LOGGER_.
Thanks,
Brian