Resolve Java Checkstyle Error: Name 'logger' must match pattern '^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$'

Because the field is marked final and static which implies that it's a constant and should be named with uppercase letters.

From this link, you can see that the module ConstantName has the format ^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$ which is exactly the one your Checkstyle plugin has specified.


The documentation recommends using this configuration if you wish to keep logger as a valid option:

<module name="ConstantName">
  <property name="format"
    value="^log(ger)?$|^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$"/>
</module>