Logging
One of the basic elements of monitoring and observability is logs. Logs allow us to detect actions that are happening in a running system. That information can be used to analyze the behavior of the system, especially any errors or bugs that may arise, giving us useful insight into what is actually going on.
Using logs correctly is deceptively difficult, though. It's easy to collect too much or too little information, or to log the wrong information. In this chapter, we will see some of the key elements of what to collect, and the general strategy to follow to ensure that logs are used to their best effect.
In this chapter, we'll cover the following topics:
- Log basics
- Producing logs in Python
- Detecting problems through logs
- Log strategies
- Adding logs while developing
- Log limitations
Let's start with the basic principles of logging.