Logging in Python

Let's learn about how to log in python

ython provides a very powerful logging library in its standard library. A lot of programmers use print statements for debugging (myself included), but you can also use logging to do this. It’s actually cleaner to use logging as you won’t have to go through all your code to remove the print statements. In this chapter we’ll cover the following topics:

  • Creating a simple logger
  • How to log from multiple modules
  • Log formatting
  • Log configuration

By the end of this chapter, you should be able to confidently create your own logs for your applications. Let’s get started!

Get hands-on with 1200+ tech skills courses.