Add a logging config option to blacklist specific loggers from logging.
Review Request #8994 — Created June 4, 2017 and submitted
This adds a new
LOGGING_BLACKLISTsetting that can be set to a list of
logger names that you want to prevent from logging to any handlers. Any
loggers listed, or any descendants of those loggers, will be ignored.
The blacklist defaults to the
django.db.backendslogger, which will log
a large amount of SQL query output. Projects or users can override the
list to include other logger names.
Tested that SQL output was no longer being logged, but everything else
was. Tested adding custom loggers as well.
This could be one statement: return all(not log_filter.filter(record) for log_filter in self._filters)