Reports Logger instances that are initialized with a class literal from a different class than the Logger is contained in. This can easily happen when copy-pasting some code from another class and may result in logging events under an unexpected category and cause filters to be applied incorrectly.

A quick-fix is provided to replace the foreign class literal with one from the surrounding class.

Example:


  public class Paramount {
    protected static final Logger LOG = Logger.getLogger(Critical.class);

    // ... other fields and methods
  }

After the quick-fix is applied:


  public class Paramount {
    protected static final Logger LOG = Logger.getLogger(Paramount.class);

    // ... other fields and methods
  }

Configure the inspection: