Python logging.config: configure logging from a file or a dictionary
Answer: The following functions configure the logging module.
Configuration functions
Their use is optional.
You can configure the logging module using these functions, or from application code.
dictConfig takes the logging configuration from a dictionary.
Configuration dictionary schema describes the contents of that dictionary.
A propagate value which is not a boolean will raise an error.
File-based setup
fileConfig reads the logging configuration from a configparser-format file.
This function can be called several times from an application.
An end user can then select from various pre-canned configurations.
If an error is encountered during configuration, this function will raise.
See also
Claims
- id: C1 claim: The following functions configure the logging module. source: S1 evidence: "The following functions configure the logging module."
- id: C2 claim: dictConfig takes the logging configuration from a dictionary. source: S1 evidence: "Takes the logging configuration from a dictionary."
- id: C3 claim: A propagate value which is not a boolean is an error. source: S1 evidence: "A propagate value which is not a boolean."
- id: C4 claim: These configuration functions are optional. source: S2 evidence: "Their use is optional"
Sources
- [S1] logging.config — Logging configuration. Python Software Foundation. https://docs.python.org/3/library/logging.config.html . License: PSF License Version 2. Accessed 2026-11-24.
- [S2] logging.config documentation (source). CPython. https://raw.githubusercontent.com/python/cpython/main/Doc/library/logging.config.rst . License: PSF License Version 2. Accessed 2026-11-24.
License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Python Software Foundation, logging.config — Logging configuration; CPython, logging.config documentation (source). PSF-2.0 (https://docs.python.org/3/license.html). Copyright Python Software Foundation. Text was condensed and changed from the originals.
License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Python Software Foundation, logging.config — Logging configuration; CPython, logging.config documentation (source). PSF-2.0 (https://docs.python.org/3/license.html). Copyright Python Software Foundation.
Cite this
iinventedlight. 2026. "Python logging.config: configure logging from a file or a dictionary." iinventedlight Library, iil:note:wzvm91q1, version of 2026-11-24. https://iinventedlight.com/library/notes/python-logging-config/. License: CC-BY-4.0.
@misc{iil_note_wzvm91q1,
author = {{iinventedlight}},
title = {{Python logging.config: configure logging from a file or a dictionary}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-24},
url = {https://iinventedlight.com/library/notes/python-logging-config/},
note = {Permanent ID iil:note:wzvm91q1. License: CC-BY-4.0.},
}
Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).
Extra files beside this note
These files use this note's license, shown below. Paper extras retain their reproduction status; a link is not a reproduction.
- python-logging-config.schema.json (schema; CC-BY-4.0)
- python-logging-config.table.json (table; CC-BY-4.0)
For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/python-logging-config.md.