---
source: https://iinventedlight.com/library/notes/python-logging-basics.md
title: "Python logging defaults to WARNING and uses named loggers"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "PSF-2.0 (Python docs); Public domain (Python Enhancement Proposals); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "Summary by iinventedlight (AI-assisted). Sources: Python docs, Logging HOWTO, PSF-2.0 (https://raw.githubusercontent.com/python/cpython/main/LICENSE); Python Enhancement Proposals, PEP 282 – A Logging System, Public domain (https://peps.python.org/pep-0282/#copyright)."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-16
status: published
approved_by: "Cole Withington, 2026-11-20 13:14 PT: \"Publish the full batch and rewrite the 6 live notes\""
checked_on: 2026-11-16
as_of: 2026-11-16
confidence: medium
untested: "Not reproduced (2026-11-16). Logging HOWTO and PEP 282 read; examples were not executed."
category: coding-references
topic_area: "code-python: logging"
tags: [python, logging, basicconfig, log-levels]
client: Librarian
sources:
  - id: S1
    title: "Logging HOWTO"
    publisher: Python docs
    url: https://docs.python.org/3/howto/logging.html
    accessed: 2026-11-16
    license: "PSF-2.0"
  - id: S2
    title: "PEP 282 – A Logging System"
    publisher: Python Enhancement Proposals
    url: https://peps.python.org/pep-0282/
    accessed: 2026-11-16
    license: "Public domain"
---
# Python logging defaults to WARNING and uses named loggers
**Answer:** Access logging functionality by creating a logger via `logger = logging.getLogger(__name__)`. The logging module's default level is `WARNING`, so events below that severity are not tracked unless logging is configured.

## Default output

A simple script can call `logging.warning()` to print to the console. In that same default setup, an `INFO` message does not appear. A `basicConfig(filename='example.log', encoding='utf-8', level=logging.DEBUG)` call sends messages to a log file.

## Levels

PEP 282 lists logging levels in increasing order: DEBUG, INFO, WARN, ERROR and CRITICAL. CRITICAL is used in preference to FATAL because the logging module does not enforce an exit outcome.

## See also

- [python-exceptions-hierarchy](https://iinventedlight.com/library/notes/python-exceptions-hierarchy/)
- [dotnet-logging](https://iinventedlight.com/library/notes/dotnet-logging/)

## Claims

- id: C1
  claim: The default logging level is WARNING.
  source: S1
  evidence: "The default level is ``WARNING``, which means that only events of this"

- id: C2
  claim: The HOWTO shows getLogger(__name__).
  source: S1
  evidence: "logger = logging.getLogger(__name__)"

- id: C3
  claim: PEP 282 orders levels by importance.
  source: S2
  evidence: "The logging levels, in increasing order of importance, are:"

## Sources

- [S1] Logging HOWTO. Python docs. https://docs.python.org/3/howto/logging.html . License: PSF-2.0. Accessed 2026-11-16.

- [S2] PEP 282 – A Logging System. Python Enhancement Proposals. https://peps.python.org/pep-0282/ . License: Public domain. Accessed 2026-11-16.

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Python docs, Logging HOWTO, PSF-2.0 (https://raw.githubusercontent.com/python/cpython/main/LICENSE); Python Enhancement Proposals, PEP 282 – A Logging System, Public domain (https://peps.python.org/pep-0282/#copyright). Text was condensed and changed from the originals.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
