Back to Intellij Community

LoggingConditionDisagreesWithLogLevelStatement

jvm/jvm-analysis-impl/resources/inspectionDescriptions/LoggingConditionDisagreesWithLogLevelStatement.html

2025.3-rc-2400 B
Original Source

Reports is log enabled for conditions of if statements that do not match the log level of the contained logging call.

For example:

if (LOG.isTraceEnabled()) {
    // debug level logged, but checked for trace level
    LOG.debug("some log message");
  }

This inspection understands the java.util.logging, Log4j, Log4j2, Apache Commons Logging and the SLF4J logging frameworks.