Make logger.error(ex);
, logger.info(ex);
, etc. print stack trace by default
#3433
Labels
logger.error(ex);
, logger.info(ex);
, etc. print stack trace by default
#3433
It is too easy to write code like this:
Especially if you come back to a project after months and you don't remember anything about the log4j API specifics.
You think you you log everything you need, but you don't get the exception's stack trace here. You'd have to write
logger.error("", ex);
here, which is extremely unintuitive! Orlogger.catching(ex)
, but that's another special thing I'd need to memorize.I propose to change the default behavior such that the stack trace is printed in this case. I don't care how it's achieved, e.g. by adding a
void error(Throwable)
overload, or adding a check in the existingvoid error(Object)
overload. The point is that it should be the default behavior because that's what's expected.The text was updated successfully, but these errors were encountered: