mpwhalen
5/4/2018 - 5:10 PM

Logging In Python

import logging

logging.basicConfig(level=logging.DEBUG, format='[%(levelname)s] %(processName)s:%(threadName)-12s %(name)s:%(lineno)-7d (%(asctime)s) %(message)s', )
logger = logging.getLogger('MdnMonReport')

def test():
  try:
    print('holder')
    raise Exception('We got an exception')
  except Exception as e:
    logger.exception('Exception in test')
  
  logger.info('info')
  logger.error('error')
  logger.debug('Done testing exception logging')


test()