Logging module
Python’s standard-library module provides configurable facilities for creating, filtering, formatting, and routing application log records.
The Well-Grounded Python Developer: How the pros use Python and Flask
The logging module is Python's standard-library module for creating, filtering, formatting, and routing diagnostic log records.
- How it is used
- Replaces diagnostic print statements with configurable messages for monitoring application activity and investigating problems.
- How deep it goes
- Works through basic logger setup and application-level configuration, including severity filtering, formatting, and STDOUT routing.
- Examples
- Uses a logged exception, YAML configuration, and DEBUG messages from Flask routes.
- What you can do after
- Operate/configure it to retain diagnostic messages while filtering DEBUG output in production and restoring it for investigation.
Python How-To
The logging module is Python's standard-library module for recording application events through loggers, handlers, formatters, and severity levels.
- How it is used
- Records application events for immediate console feedback or later inspection in a file.
- How deep it goes
- Works through logger creation, file and stream handlers, severity filtering, and formatting; mentions other handler types without detailing them.
- Examples
- Uses a task-removal event, a saved log file, console warnings, level-filtered messages, and timestamped records.
- What you can do after
- Operate/configure it to route, filter, and format application records for console viewing and file storage.
The Art of Code
Python's logging module is a standard-library facility for creating, filtering, formatting, and routing log records.
- How it is used
- Supports production diagnostics by routing filtered, formatted records to destinations suited to persistence, aggregation, and monitoring.
- How deep it goes
- Explains destinations, formats, filtering, severity levels, and message quality, but does not detail Python configuration APIs.
- Examples
- Uses console printing, stack traces, vague messages, and contextual parsing errors to contrast weak and useful diagnostics.
- What you can do after
- Evaluate/understand when console output is insufficient and how contextual messages improve failure investigation.
ASP.NET Core in Action, 3e
A logging library provides APIs for recording and routing diagnostic and operational messages from an application.
- How it is used
- Supports ASP.NET Core monitoring and troubleshooting by recording events and routing diagnostic output.
- How deep it goes
- Explains the architecture, dependency-injection integration, ILogger records, verbosity, and logging providers.
- Examples
- Uses negative shopping-cart totals, exceptions, console output, files, and external services as logging examples.
- What you can do after
- Diagnose application errors by creating structured log messages and routing them to suitable destinations.
Read how ASP.NET Core in Action, 3e explains logging module →
Related concepts
- logging leveluses · A logging level is a severity or verbosity classification or setting that determines which log messages a logging system processes, emits, or retains.
- printalternative to · Print is a programming operation that writes a value or its textual representation to an output destination, often standard output.
- FileHandlerhas part · FileHandler is a Python logging handler class that writes log records to a file.
- standard librarypart of · A standard library is a collection of reusable modules, types, functions, APIs, and other facilities distributed with a programming language implementation or platform.
- Log4jincludes · Log4j is an Apache Java logging framework for recording, formatting, and routing application messages and events to configurable destinations and severity levels.
- Dockerused by · Docker is a platform and ecosystem for building, distributing, and running applications in containers.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.



