Inspectopedia Help

Non-distinguishable logging calls

Reports SLF4J, Log4j2 logging calls in one class, such as logger.info("message: {}", key) with similar log messages. These calls can be non-distinguishable from each other, and this introduces difficulties to understand where a certain log message is coming from.

Example (for Java):

private static void request1(String text) { log.info("Message: {}", text); //similar call doSomething1(); } private static void request2(int i) { log.info("Message: {}", i); //similar call doSomething2(); }

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.

LoggingSimilarMessage
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.

Settings or Preferences | Editor | Inspections | JVM languages | Logging

  • Use the Minimum length of a similar sequence option to set the minimum length of similar sequences after which calls will be reported

  • Use the Do not report calls with the 'error' log level option to ignore messages with `error` log level and when there is an exception. It may be useful to hide the warnings, because call sites can still be located using stack traces

New in 2024.1

Inspection options

Here you can find the description of settings available for the Non-distinguishable logging calls inspection, and the reference of their default values.

Minimum length of a similar sequence

5

Do not report calls with `error` log level

Default: Selected

Availability

By default bundled with

IntelliJ IDEA 2024.1, Qodana for JVM 2024.1,

Can be installed with plugin

Java, 241.18072

Last modified: 18 June 2024