Fix logging to work with stack traces