Feb-24-2017, 12:05 AM
Hi,
I have the following code to log the completion status of my script:
Thank you!
I have the following code to log the completion status of my script:
import logging try: logging.basicConfig(filename="C:/Users/AppData/Local/Programs/Python/Python35-32/myScript/log.txt", format='%(asctime)s: %(message)s', datefmt='%m/%d/%Y %I:%M:%S %p', level=logging.INFO) logging.info("Process initiated.") ##code to do things logging.info("Process complete. %s %s %s", "\n", "-"*100, "\n") except Exception, e: logging.exception(e, exc_info=True)I wanted to log error if it is raised. My question is, how do I output it to the same log.txt filed that I have from logging.basicConfig?
Thank you!