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:
public class Significant {
private Logger LOG = Logger.getLogger(Critical.class);
}
After the quick-fix is applied:
public class Significant {
private static final Logger LOG = Logger.getLogger(Critical.class);
}
- 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
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.
Here you can find the description of settings available for the Non-constant logger inspection, and the reference of their default values.
Inspection Details | |
---|---|
By default bundled with: | |
Can be installed with plugin: | Java, 243.23126 |
Thanks for your feedback!