Table of Contents

Logging

Sample

import logging
logging.basicConfig(level=logging.DEBUG)
import logging
import traceback
logging.basicConfig(filename=logfile, level=logging.DEBUG, format="[%(asctime)s] pid=%(process)d:%(levelname)s:%(name)s:%(message)s")
logging.getLogger().addHandler(logging.StreamHandler())
logging.error(traceback.format_exc())

References

https://www.tohoho-web.com/python/logging.html