Managing Spring application logs with ELK
When building systems that are intended to be deployed, an important thing to consider is the means by which server log files are managed. A server log is a log file that is created and maintained by a server. Log files generally consist of a list of activities that a server performed. A means of managing application log files that should be strongly considered is the use of the ELK (Elasticsearch, Logstash, and Kibana) stack. In this section, we will learn how to manage Spring application log files with the ELK stack.
Generating logs with Spring
Before getting started with setting up an ELK stack to manage our Spring logs, we must configure Spring to generate log files. This can easily be done with a Spring project's application.properties file. Let's configure our Place Reviewer backend to generate logs.
Open up the project's application.properties
file and add the following line of code:
logging.file=application.log
This line of code configures Spring...