Added logging of stack trace for exception thrown