4 Making the most of logs: Auditing an app’s behavior
This chapter covers
- Effectively using log messages to understand an app’s behavior
- Correctly implementing log capabilities in your app
- Using AI assistants to investigate large log files
- Avoiding issues caused by logs
In this chapter, we will discuss using log messages that an app records. The concept of logging didn’t first appear with software. For centuries, people used logs to help them understand past events and processes. People have used logging since writing was invented, and we still use it today. All ships have logbooks. Sailors record decisions (direction, speed increase or decrease, etc.) and given or received orders, along with any encountered event (figure 4.1). If something happens to the onboard equipment, they can use the logbook notes to understand where they are and navigate to the nearest shore. If an accident happens, the logbook notes can be used in the investigation to determine how the unfortunate event could have been avoided.
Figure 4.1 Sailors store events in logs that they can use to determine their route or analyze the crew’s response to a given event. In the same way, apps store log messages so that developers can later analyze a potential issue or discover breaches in the app.
