鉴于以下代码,一些python专家能否告诉我logging.exception
如何引用异常以将其打印出来?
>>> try:
... 1/0
... except:
... logging.exception("message")
...
ERROR:root:message
Traceback (most recent call last):
File "<console>", line 2, in <module>
ZeroDivisionError: integer division or modulo by zero
我假设它正在通过追溯来获取该异常消息,但很高兴听到专家的意见。