Monday, April 17, 2023

Python File Logging

logging.basicConfig(filename=logname,
                    filemode='a',
                    format='%(asctime)s,%(msecs)d %(name)s %(levelname)s %(message)s',
                    datefmt='%H:%M:%S',
                    level=logging.DEBUG)

logging.info("Running Urban Planning")

logger = logging.getLogger('urbanGUI')

references

https://stackoverflow.com/questions/6386698/how-to-write-to-a-file-using-the-logging-python-module

No comments:

Post a Comment