better exception logging
Merge pull request #4707 from dimagi/log

better exception logging