Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Turn on debug logging in python

Tags:

python

logging

I'm trying to turn on debug logging in python 3.5.2:

import logging
log = logging.getLogger('test')
log.setLevel(logging.DEBUG)

log.warn('warn')
log.debug('debug')

log.root.setLevel(logging.DEBUG)
log.debug('debug again')

However, this only prints warn. What am I missing?

like image 761
xdhmoore Avatar asked Jan 22 '17 22:01

xdhmoore


1 Answers

Try this

logging.basicConfig(level=logging.DEBUG)
like image 100
Harald Nordgren Avatar answered Sep 19 '22 01:09

Harald Nordgren