Other Concepts && Tools
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1621058/images/8278139/Logo_Horizontal_White__Black_Background_.jpg)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1621058/images/8278150/Symbol_Negative__Black_Background_.jpg)
Logging
Logging
Production code
To make our code production-ready there a few things to consider, including how to monitor the application’s flow.
Logging is important if you want to diagnose problems or understand what’s happening with your application, as it runs.
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1628261/images/8791401/pasted-from-clipboard.png)
But what is logging exactly?
Logging is the process of recording information about usage patterns, activities, operations, and output within an operating system, application, server or another device.
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1628261/images/8792208/pasted-from-clipboard.png)
These activities are registered in a log file.
LOGGING IMPORTANCE
- INFORMATIVE: If properly set, logs can provide useful information, helping us understand what the code is doing.
- DIAGNOSTIC: stack traces play a part in problem solving, telling us exactly what happened in our code and where, but they can't tell us what happened before the error was thrown.
- AUDITING: We can log the events that happened during runtime (diagnostic), but we can also log more abstract business logic events. like user actions or other things that have either administrative value or, more importantly, legal value.
LOGGING Levels
We can classify the entries in our log file in terms of urgency. For that, we use logging levels.
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1628261/images/8792217/pasted-from-clipboard.png)
LOGGING TOOLS
Every programming language has at least one logging framework that allows us to store data in different formats.
In Java, we can take a pick between Java’s own logging tools, java.util.logging, or other external frameworks like Logback or the most popular Log4j2.
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1628261/images/8792222/pasted-from-clipboard.png)
LIVe coding
Log4j2 in a Spring Boot project
EXERCISE
Car Rental - Rest API with Logging Integration
Logging
By Soraia Veríssimo
Logging
- 1,616