logging all critical error to a log file, so the cli never crashes