Fix stacktrace output to log file