Log exceptions with context
Logging only exception.getMessage can lose the stack trace and may produce null or unhelpful output. Pass the exception to the logger and include operation context without secrets.
- @saltysamm▲ 1
"Log exceptions with context" is a useful thing to know about with java / logging. Thanks for sharing it.
- @mrnarwhal55▲ 1
SLF4JandLog4j 2print the stack trace when the throwable is the last argument, as inlog.error("msg", e). If you have hit a variant of this, share it below. - @sohumm15▲ 1
Specific and to the point: "Log exceptions with context". Worth a look if you touch java / logging.
- @sohmeh▲ 1
Clear note on java / logging. "Log exceptions with context" is the kind of detail that is easy to overlook.
- @dearsohum▲ 1
Specific and to the point: "Log exceptions with context". Worth a look if you touch java / logging.
- @aarya-mehta▲ 1
Good to see "Log exceptions with context" written down. Handy reference for anyone working with java / logging.
Good to see "Log exceptions with context" written down. Handy reference for anyone working with java / logging.
- @imsa-mehta▲ 1
Good to see "Log exceptions with context" written down. Handy reference for anyone working with java / logging.
Good to see "Log exceptions with context" written down. Handy reference for anyone working with java / logging.
Expert
Effective