使用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 (将#修改为@)