Scala: print a stack trace in my Scalatra app
I think you want printStackTrace()
rather than getStackTrace
. If you are outputting to a log file, getMessage()
may be helpful. Or you may try passing the whole exception object to the logger.
Use ExceptionUtils from Apache Commons Lang:
import org.apache.commons.lang3.exception.ExceptionUtils
(...)
logger.info("an exception occurred: " + ExceptionUtils.getStackTrace(e))