Aller au contenu

Inappropriate Log Level (ARCH4161)

Ce contenu n’est pas encore disponible dans votre langue.

Key java.logging.inappropriate-log-level · Severity info · Category logging

Logging errors at info/debug causes warnings to be missed, while logging routine flow at error drowns real failures in noise. Choose the level based on the severity of the event.

try {
payment.charge(amount);
} catch (PaymentException e) {
log.info("Payment failed", e);
}
try {
payment.charge(amount);
} catch (PaymentException e) {
log.error("Payment failed: {}", amount, e);
}

Choose the log level by the event’s real severity: errors at error, warnings at warn, routine info at info.