
Master python's logging module, including levels, formatting, filters, and handlers, and learn to stream logs to stdout, files, or email, plus decorators and concurrency considerations.
Learn what logs are in Python, why logging beats printing, and how to create a simple hello world log script with basic config, timestamps, and log levels.
Learn Python logging levels, from not set to critical, and use logger.exception to capture exceptions with full traceback for debugging.
Explore the available Python logging handlers and route logs to streams, files, or sockets using basic config. Attach multiple handlers to a logger and apply boilerplate, formatters, and filters.
Explore how log formatters enhance Python log messages by adding metadata like timestamp, level, file name, and line number, and learn to format dates and use parameters.
Configure Python logging using the logging API, file config, and dict config, including handlers, formatters, and levels to control where, how, and what logs are produced.
Learn to create and apply a Python logging filter by subclassing logging.Filter or using a filter method, and attach it to a logger or a handler.
Learn to share a single logger across multiple modules using the Python logging API, then configure the same setup with a dictionary config.
Create a Python logging decorator that logs exceptions, preserves function metadata with functools.wraps, and passes a logger to enable swapping loggers for different contexts.
Learn to implement rotating logs in Python by file size, timed rotations, and config-based setups, with custom rotator and namer to manage backups.
Explore logs and concurrency in Python by using threading, multiprocessing, and concurrent futures, with practical examples of thread-safe logging, queue handlers, and asynchronous logging.
Install Lugaru with pip and log with two lines of code, exploring sinks and formatting. Catch exceptions with a decorator, enable color terminal output, and manage rotation, compression, and retention.
Learn to use structlog for Python logging, install and configure it, format and serialize logs to JSON, log exceptions, and write logs to disk.
Celebrate completing the Python logging course and explore Python's logging module along with alternate logging options. Reach out with questions, and I hope to see you in other classes.
What does every new developer do when they are first learning to program? They print out strings to their terminal. It's how we learn! But printing out to the terminal isn't what you do with most professional applications.
In those cases, you log into files. Sometimes, you log into multiple locations at once. These logs may serve as an audit trail for compliance purposes or help the engineers debug what went wrong.
Python Logging teaches you how to log in the Python programming language. Python is one of the most popular programming languages in the world. Python comes with a logging module that makes logging easy.
Whether you are a beginner with Python or a seasoned programming rock star, Michael Driscoll will help you continue to grow in your developer journey. My blog, Mouse Vs Python, has hundreds of awesome tutorials that you can read for free!
You can rest assured that Michael knows Python. He has been programming and writing about it for over a decade and has ten other Python books!
What You'll Learn
In this course, you will learn how about the following:
Logger objects
Log levels
Log handlers
Formatting your logs
Log configuration
Logging decorators
Rotating logs
Logging and concurrency
and more!