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
- Uses logging to preserve application events and provide real-time feedback during development.
- How deep it goes
- Walks through logger creation, handlers, levels, and formatting, while only briefly noting specialized handlers.
- Examples
- Logs a task’s database removal, sends a warning to file and console, and formats task-application events.
- What you can do after
- Operate and configure Python logging with named loggers, file and stream handlers, severity thresholds, and formatters.
Software Engineering for Data Scientists
logging is Python's standard library module for recording diagnostic messages to streams or files at configurable severity levels.
- How it is used
- Supports monitoring and debugging of production code, especially machine learning pipelines.
- How deep it goes
- Defines severity levels and configures file output, formatting, and pipeline checkpoints, without detailing logging internals.
- Examples
- Uses critical, error, warning, and info messages plus customer churn pipeline logs for successful and failed runs.
- What you can do after
- Operate/configure logging for a pipeline and diagnose missing configuration or incomplete execution from recorded messages.
Read how Software Engineering for Data Scientists explains logging module →
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 →
Also covered in
- Logs and Telemetry
- Kafka for Architects
- Troubleshooting Java, Second Edition
- Learn Docker in a Month of Lunches, Second Edition
- Build Applications with Local AI Models on a Mac
What to know first
- PythonPython is a high-level, general-purpose, dynamically typed programming language with readable syntax and support for multiple programming paradigms.
- monitoringMonitoring is the ongoing observation and measurement of a system or process to assess its behavior or condition and detect changes, failures, or other problems.
- JavaScriptJavaScript is a high-level, dynamically typed programming language standardized as ECMAScript and used for web and general-purpose programming.
- productionProduction is the live operational setting in which a deployed software system serves its intended users or processes real workloads.
Related concepts
- logging leveluses · A logging level is a severity or diagnostic-detail classification that helps determine which log events a logging system records or emits.
- Dockerused by · Docker is a platform and toolset for building, distributing, and running applications in containers.
- FileHandlerhas part · FileHandler is a Python logging handler class that writes log records to a file.
- Flaskused by · Flask is a lightweight Python web framework based on WSGI for building web applications and services.
- Fluent Bituses · Fluent Bit is a lightweight, open-source telemetry agent for collecting, processing, and forwarding logs and other event data.
- Log4jincludes · Log4j is an Apache Java logging framework for recording application events and configuring their severity levels, formats, and destinations.
Questions about logging module
What is logging module?
Python’s standard-library module provides configurable facilities for creating, filtering, formatting, and routing application log records.
Which Manning books explain logging module?
The Well-Grounded Python Developer: How the pros use Python and Flask, Python How-To, Software Engineering for Data Scientists, The Art of Code and ASP.NET Core in Action, 3e.
What should I know before learning logging module?
Manning books that teach logging module usually introduce Python, monitoring, JavaScript and production first.
What kinds of logging module are there?
Kinds of logging module include Log4j.
What are the parts of logging module?
Logging module includes FileHandler.
What is logging module also called?
Logging module is also called logging library or logging framework.
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.




