Logging everything to file and only DEBUG messages to console in python
Logging everything to file and only DEBUG messages to console in python Question: I want logger to log everything to file but only debug messages to console. This answer suggests creating custom handler. I tried following: import logging import sys class DebugConsoleHandler(logging.StreamHandler): def __init__(self): super().__init__(stream = sys.stdout) def emit(self, record): if not record.levelno == logging.DEBUG: …