Non-constant logger
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:
Locating this inspection
- By ID
Can be used to locate inspection in e.g. Qodana configuration files, where you can quickly enable or disable it, or adjust its settings.
NonConstantLogger- Via Settings dialog
Path to the inspection settings via IntelliJ Platform IDE Settings dialog, when you need to adjust inspection settings directly from your IDE.
Configure the inspection:
Use the Logger class name table to specify logger class names. The inspection will report the fields that are not
static
andfinal
and are of the type equal to one of the specified class names.
Inspection options
Here you can find the description of settings available for the Non-constant logger inspection, and the reference of their default values.
- Logger class names
[java.util.logging.Logger, org.slf4j.Logger, org.apache.commons.logging.Log, org.apache.log4j.Logger, org.apache.logging.log4j.Logger]
Inspection Details | |
---|---|
By default bundled with: | |
Can be installed with plugin: | Java, 242.22892 |