import logging
logging.basicConfig(filename='d:\\example.log',format='%(asctime)s %(levelname)s:%(message)s', level=logging.DEBUG)
#logging.basicConfig(filename='d:\\example.log',level=logging.DEBUG)
logging.debug('This message should go to the log file')
logging.info('So should this')
logging.warning('And this, too')