You are using the logging module in a long-running service. You need to ensure that a specific logger named 'app.db' writes DEBUG and higher messages to a file, but its parent logger 'app' must not propagate these DEBUG messages to the root logger. Which configuration achieves this?
Setting the logger level to DEBUG allows DEBUG and higher messages to be processed. Adding a FileHandler directs them to a file. Setting propagate to False prevents the logger from passing records to its parent 'app' and ultimately the root logger, so DEBUG messages do not reach other handlers. This exactly meets the requirement without affecting other loggers.
Why this answer
To keep DEBUG messages from 'app.db' confined to its own FileHandler, the logger must process DEBUG records and must not propagate them to ancestors. Setting the logger level to DEBUG enables processing, adding a FileHandler writes to the file, and setting propagate to False stops upward propagation. Other options either allow propagation or attempt to control it via unrelated levels or handlers, which does not achieve the isolation.
Exam trap
The trap here is thinking that setting the root logger level or adding a NullHandler to a parent will suppress propagated records, when propagation bypasses level checks and NullHandler only discards records after they have already been passed upward.