Python Glossary Русский

all Python 3multiprocessingfunction

multiprocessing.get_logger()

logging

Returns the multiprocessing module's own logger, named 'multiprocessing'. Initially it has no handlers, and its messages do not reach the root logger.

Syntax

multiprocessing.get_logger()

Its propagate is off (0), so logging.basicConfig() will not show its messages; add a handler to it directly or call log_to_stderr(). It logs the module's internals (start-up, shutdown, finalizers) and is not the place for your program's logs. Under spawn only the logger level reaches the child; handlers and formatters have to be set up again inside the child.

Examples

import multiprocessing as mp
if __name__ == '__main__':
    lg = mp.get_logger()
    print(lg.name, bool(lg.propagate), lg.handlers)  # → multiprocessing False []

See also

Open in the full glossarydocs.python.orgReport an inaccuracy