apereo/cas · warning

warn(logger, getMessage(throwable), throwable)

Error message

warn(logger, getMessage(throwable), throwable)

What it means

LoggingUtils.warn(Logger, Throwable) is a convenience that logs an exception at WARN level: it derives the message via getMessage(throwable) (falling back to the class name when all messages are null) and delegates to warn(logger, message, throwable). It exists to normalize exception logging across CAS, including stack-trace summarization.

Solutions

  1. Inspect the derived message (exception message or exception class name) to identify the root cause
  2. If the stack trace is summarized/truncated and you need details, enable full stack traces or raise the log level as configured for LOG_MESSAGE_SUMMARIZER
  3. Fix the underlying recoverable condition instead of suppressing the warn

Example fix

// before
} catch (Exception e) {
    LOGGER.warn("something failed", e); // inconsistent, full trace spam
}
// after
} catch (Exception e) {
    LoggingUtils.warn(LOGGER, e); // normalized message + summarizer-aware
}
Defensive patterns

Strategy: try-catch

Try / catch

try {
    riskyOperation();
} catch (Exception e) {
    LoggingUtils.warn(LOGGER, e);
    // continue with fallback behavior
}

Prevention

When it happens

Trigger: Any CAS code catching a non-fatal exception and calling LoggingUtils.warn(LOGGER, e) instead of logger.warn directly. It throws nothing itself; the 'error' entry is the emitted warn event.

Common situations: Recoverable I/O or resource-check failures (e.g. resource existence probes); best-effort background tasks whose failure should not fail the request; developers unsure how to log a throwable consistently.

Related errors


AI-assisted analysis of apereo/cas@e7288fc434 (2026-09-08). Data as JSON: /api/errors/b35f012108d38f45. Report an issue: GitHub.

Appendix: source

Thrown at core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/LoggingUtils.java:140

    /**
     * Log Error.
     *
     * @param logger    the logger
     * @param throwable the throwable
     */
    public static void error(final Logger logger, final Throwable throwable) {
        if (throwable != null) {
            error(logger, getMessage(throwable), throwable);
        }
    }

    /**
     * Log warning.
     *
     * @param logger    the logger
     * @param throwable the throwable
     */
    public static void warn(final Logger logger, final Throwable throwable) {
        warn(logger, getMessage(throwable), throwable);
    }

    /**
     * Log warning.
     *
     * @param logger    the logger
     * @param message   the message
     * @param throwable the throwable
     */
    public static void warn(final Logger logger, final String message, final Throwable throwable) {
        FunctionUtils.doIf(LOG_MESSAGE_SUMMARIZER.shouldSummarize(logger),
                _ -> logger.warn(LOG_MESSAGE_SUMMARIZER.summarizeStackTrace(message, throwable)),
                _ -> logger.warn(message, throwable))
            .accept(throwable);
    }

    /**

View on GitHub (pinned to e7288fc434)