如何解决使用Python中的日志记录模块无法打印回溯,并且应用程序不会终止
我正在尝试转换脚本的回溯功能,以使其在我的日志记录模块中打印出来。但由于无法正确打印,我无法这样做。我应该如何重新配置该语句?
这是我最初的声明:
tick$ = this.timerService.tick$;
questionStarted$ = this.timerService.questionStarted$;
startTimer = this.timerService.startTimer;
stopTimer = this.timerService.stopTimer
constructor (private timerService: TimerService) {}
如何转换此语句以使其与我的记录器对象一起打印。 我试过了,但是我认为它不能正常工作:
try:
with open(args.outFile,"wb") as outputFile:
outputFile.write(tempBuffer.getvalue())
except:
#exc_type,exc_value,exc_traceback = sys.exc_info()
terminate(-1,"ERROR: Can't write to the output file: {}
({})".format(args.outFile,traceback.print_exc()))
最初,终止字在到达该行后会终止应用程序,但现在它不这样做。如何在try:
with open(args.outFile,"wb") as outputFile:
outputFile.write(tempBuffer.getvalue())
except:
exc_type,exc_traceback = sys.exc_info()
logger.exception("ERROR: Can't write to the output file:
{}".format(args.outFile))
中包含该终止符?
logger.exception()
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。