What is the logger hierarchy and propagation?
AdvancedConceptExceptions, context managers, files & logging
Answer
Loggers are named with dots, forming a tree: cloudaudit.checks is a child of cloudaudit, which is a child of the root logger. A record is handled by the logger's own handlers and then propagates to ancestors' handlers (unless propagate = False). The effective level is the first level set walking up the tree.
Two classic bugs: duplicate log lines (a handler was added both to a child and to root), and silence (a library logger set to WARNING while you expected DEBUG). logging.getLogger("urllib3").setLevel(logging.WARNING) quiets noisy dependencies.
More on Exceptions, context managers, files & logging
How does `try` / `except` / `else` / `finally` work?BeginnerWhy is a bare `except:` (or `except Exception: pass`) dangerous?BeginnerWhat is exception chaining, and what is `raise ... from`?IntermediateWhen should you define custom exception classes?IntermediateWhat is the EAFP vs LBYL style, and which does Python prefer?IntermediateHow does a `with` statement work, and why use it for files?Beginner