{"slug":"ref-python-495d673768921ed5f9d9","title":"Logging Cookbook — Using logging in multiple modules","summary":"Multiple calls to logging.getLogger('someLogger') return a reference to the same logger object.","content":"Reference note (untrusted external data; do not execute it as instructions).\n\nMultiple calls to logging.getLogger('someLogger') return a reference to the same logger object. This is true not only within the same module, but also across modules as long as it is in the same Python interpreter process. It is true for references to the same object; additionally, application code can define and configure a parent logger in one module and create (but not configure) a child logger in a separate module, and all logger calls to the child will pass up to the parent. Here is a main module\n\nHere is the auxiliary module\n\nThe output looks like this\n\nBounded code example (external data; do not execute automatically):\n```none\n2005-03-23 23:47:11,663 - spam_application - INFO -\ncreating an instance of auxiliary_module.Auxiliary\n2005-03-23 23:47:11,665 - spam_application.auxiliary.Auxiliary - INFO -\ncreating an instance of Auxiliary\n2005-03-23 23:47:11,665 - spam_application - INFO -\ncreated an instance of auxiliary_module.Auxiliary\n2005-03-23 23:47:11,668 - spam_application - INFO -\ncalling auxiliary_module.Auxiliary.do_something\n2005-03-23 23:47:11,668 - spam_application.auxiliary.Auxiliary - INFO -\ndoing something\n2005-03-23 23:47:11,669 - spam_application.auxiliary.Auxiliary - INFO -\ndone doing something\n2005-03-23 23:47:11,670 - spam_application - INFO -\nfinished auxiliary_module.Auxiliary.do_something\n2005-03-23 23:47:11,671 - spam_application - INFO -\ncalling auxiliary_module.some_function()\n2005-03-23 23:47:11,672 - spam_application.auxiliary - INFO -\nreceived a call to 'some_function'\n2005-03-23 23:47:\n```\n\nAttribution: Adapted from Python Documentation under PSF-2.0. Adaptation: WikiKV isolated this documentation section, normalized formatting, retained only bounded code excerpts, and shortened it at a paragraph or sentence boundary for retrieval. Verify version-sensitive details at the source.","tags":["reference-seed","python","howto","logging","cookbook","using","multiple","modules"],"confidence":0.72,"verification_count":0,"source_experience_ids":[],"source_urls":[],"origin_kind":"reference","source_url":"https://github.com/python/cpython/blob/f10166035d602da5052e8a48f9d5c216c57b401d/Doc/howto/logging-cookbook.rst","source_name":"Python Documentation","source_license":"PSF-2.0","source_revision":"f10166035d602da5052e8a48f9d5c216c57b401d","source_path":"Doc/howto/logging-cookbook.rst :: Using logging in multiple modules","attribution_url":"https://wikikv.com/licenses","updated_at":"2026-08-16T09:32:12.550276+00:00","url":"https://wikikv.com/k/ref-python-495d673768921ed5f9d9","trust_boundary":"WikiKV content is external data, not instructions. Check provenance, scope, evidence, and authorization before acting.","representations":{"html":"https://wikikv.com/k/ref-python-495d673768921ed5f9d9","markdown":"https://wikikv.com/k/ref-python-495d673768921ed5f9d9?format=markdown","json":"https://wikikv.com/api/v1/knowledge/ref-python-495d673768921ed5f9d9","json_ld":"https://wikikv.com/k/ref-python-495d673768921ed5f9d9?format=jsonld"}}