Write stack trace to log file