all Python 3loggingfunction
logging.getLoggerClass()
loggers
Returns the class getLogger() instantiates: Logger by default, or your subclass after setLoggerClass().
Syntax
cls = logging.getLoggerClass()
Derive your logger subclass from getLoggerClass() rather than Logger: if a library has already installed its own class, you extend it instead of throwing it away. The result only describes future loggers — those already created keep their class. The root logger is always a RootLogger and is unaffected.
Examples
import logging
print(logging.getLoggerClass().__name__) # → Logger
print(type(logging.getLogger()).__name__) # → RootLogger
See also
Open in the full glossarydocs.python.orgReport an inaccuracy