Udemy
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    •  
Turn what you know into an opportunity and reach millions around the world.
Learn More
Your cart is empty.
Keep shopping
Python Logging Course
Rating: 3.9 out of 5(4 ratings)
60 students

Python Logging Course

Auditing and Debugging Through Python Logging
Last updated 9/2024
English
English [Auto],

What you'll learn

  • Learn how to use Python's logging module
  • Learn why logging and code auditing is important
  • How to format logs so they are using for debugging
  • Learn how to log to multiple locations at once

Course content

1 section14 lectures2h 50m total length
  • Welcome to Python Logging1:23

    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.

  • Introduction to Logging10:21

    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.

  • Log Levels11:05

    Learn Python logging levels, from not set to critical, and use logger.exception to capture exceptions with full traceback for debugging.

  • Log Handlers15:10

    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.

  • Log Formatters18:40

    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.

  • Log Configuration14:17

    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.

  • Log Filters7:19

    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.

  • Logging from Multiple Modules10:25

    Learn to share a single logger across multiple modules using the Python logging API, then configure the same setup with a dictionary config.

  • Creating a Logging Decorator11:21

    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.

  • Rotating Logs13:30

    Learn to implement rotating logs in Python by file size, timed rotations, and config-based setups, with custom rotator and namer to manage backups.

  • Logs and Concurrency23:52

    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.

  • Logging with Loguru16:57

    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.

  • Logging with Structlog16:03

    Learn to use structlog for Python logging, install and configure it, format and serialize logs to JSON, log exceptions, and write logs to disk.

  • Thanks for taking Python Logging0:29

    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.

Requirements

  • Knowing how to write simple Python would be good

Description

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!


Who this course is for:

  • This course is for anyone who wants to learn how to use Python's logging module effectively