Exception Not Logged With Object (ARCH4159)
Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.
Key java.logging.exception-not-logged · Severity warning · Category logging
Logging only a message string in a catch block without passing the exception object loses the stack trace and the root cause. Pass the exception as the last argument to the logger.
Incorrect
Section titled “Incorrect”try { repository.save(user);} catch (SQLException e) { log.error("Save failed: " + e.getMessage());}Correct
Section titled “Correct”try { repository.save(user);} catch (SQLException e) { log.error("Save failed: {}", user.id(), e);}Pass the exception object as the last argument to the logger call so the full stack trace is recorded.