Pay Notebook Creator: Roy Hyunjin Han 0 Set Container: Numerical CPU with TINY Memory for 10 Minutes 0 Total 0

20170731-1515 - 20170731-1530: 15 minutes

Here we briefly want to check that we can set logging at the package level and have the same logging configuration apply to its subpackages.

1. Configure logging for "whee" to include DEBUG messages
2. Check that we can see the DEBUG message sent to "whee"
3. Check that we can see the DEBUG message sent to "whee.plus"
In [1]:
import logging
logging.getLogger('whee').setLevel(logging.DEBUG)
logging.basicConfig()

In [2]:
log = logging.getLogger('whee')

DEBUG:whee:made you look

log = logging.getLogger('whee.plus')

DEBUG:whee.plus:made you look again

In conclusion, we can safely configure logging at the package level and use logging.getLogger(__name__) in each subpackage.