Inspectopedia Help

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.


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); }

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.

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:

IntelliJ IDEA 2024.1, Qodana for JVM 2024.1,

Can be installed with plugin:

Java, 241.16690

Last modified: 29 April 2024