Fix logging stacktrace.

similar as https://github.com/kramarz/raven-python/commit/18117f3b491557591879c20f9f6e21bf020f71e3