The Python Papers

The Python Papers

Python Logging - Working with Filters

Mike Driscoll's avatar
Mike Driscoll
Jun 17, 2026
∙ Paid

Python’s logging module provides support for filters. You can add a Filter to a Handler or a Logger object for more sophisticated filtering than you can get through log levels.

Python’s documentation gives the following example of how you might use a logging filter:

A filter initialized with ‘A.B’ will allow events logged by loggers ‘A.B’, ‘A.B.C’, ‘A.B.C…

User's avatar

Continue reading this post for free, courtesy of Mike Driscoll.

Or purchase a paid subscription.
© 2026 Mike Driscoll · Privacy ∙ Terms ∙ Collection notice
Start your SubstackGet the app
Substack is the home for great culture