Simple Python Logging Callling Reload to Help Save Logging to File
In this notes, we are looking at a simple but yet useful and powerful logging in Python In [77]:
1 2 3 4 5 6 7 8 9 10 11 12 |
import logging #levels of logging are #1 debug - detailed info #2 info - confirmation that things went according to plan #3 warning - something unexpected happened #4 error - some function failed #5 critical - something failed and application must close from imp import reload reload(logging) # this will help our logging to be saved to file logging.basicConfig(filename='logFile3.log',format='%(asctime)s %(message)s', level=logging.DEBUG) # the logging will only log the level you set it to and any #other levels ABOVE it but NOT below it |
…