Add stack trace to log message.

Cherry-pick to upstream/develop