Python 3.6 Logging time is not listed

Keep Secret ntrewartha2 at gmail.com
Mon Aug 13 12:37:19 EDT 2018


#!/usr/bin/env python3
import logging
logging.basicConfig(filename='example.log',level=logging.DEBUG)
logging.basicConfig(format='%(asctime)s;%(levelname)s:%(message)s', level=logging.DEBUG)
logging.debug('Message1)
logging.info('Message2')
logging.warning('Message3')

DEBUG:root:Message1
INFO:root:Message2
WARNING:root:Message3
BUT if I remove logging.basicConfig(filename='example.log',level=logging.DEBUG)
I get 
2018-08-13 18:35:48,982;DEBUG:Message1
2018-08-13 18:35:48,982;INFO:Message2
2018-08-13 18:35:48,983;WARNING:Message3

Can someone please tell me what I am doing wrong?
Thanks





More information about the Python-list mailing list