How to print an exception stack trace using Log4J

All you have to do to print the stack trace of an exception using Java and Log4J (or the Apache Commons Logging project) is this:

log.error("Your description here", exception);


However, if you use

logger.error(exception);

it will only print the name of the Exception.

Comments