Inspectopedia
 
2024.3

Non-constant logger

Warning
New
Last modified: 03 December 2024

Reports logger fields that are not declared static and/or final. Ensuring that every class logger is effectively constant and bound to that class simplifies the task of providing a unified logging implementation for an application.

A quick-fix is provided to change the logger modifiers to static final.

Example:

After the quick-fix is applied:

Configure the inspection:

  • Use the Logger class name table to specify logger class names. The inspection will report the fields that are not static and final and are of the type equal to one of the specified class names.